Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f1253cd6 authored by Brett Chabot's avatar Brett Chabot
Browse files

Upgrade junit.runner classes to their JUnit4.10 implementation.

Bug 5826326

Change-Id: If7e4c48a4369c1056dee5a2049c891bb6ab7d8d0
parent 9766937b
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -41832,7 +41832,7 @@ package junit.framework {
    method public static void fail();
  }
  public class AssertionFailedError extends java.lang.Error {
  public class AssertionFailedError extends java.lang.AssertionError {
    ctor public AssertionFailedError();
    ctor public AssertionFailedError(java.lang.String);
  }
@@ -41890,9 +41890,9 @@ package junit.framework {
    method public synchronized void addListener(junit.framework.TestListener);
    method public void endTest(junit.framework.Test);
    method public synchronized int errorCount();
    method public synchronized java.util.Enumeration errors();
    method public synchronized java.util.Enumeration<junit.framework.TestFailure> errors();
    method public synchronized int failureCount();
    method public synchronized java.util.Enumeration failures();
    method public synchronized java.util.Enumeration<junit.framework.TestFailure> failures();
    method public synchronized void removeListener(junit.framework.TestListener);
    method protected void run(junit.framework.TestCase);
    method public synchronized int runCount();
@@ -41909,21 +41909,21 @@ package junit.framework {
  public class TestSuite implements junit.framework.Test {
    ctor public TestSuite();
    ctor public TestSuite(java.lang.Class, java.lang.String);
    ctor public TestSuite(java.lang.Class);
    ctor public TestSuite(java.lang.Class<?>);
    ctor public TestSuite(java.lang.Class<? extends junit.framework.TestCase>, java.lang.String);
    ctor public TestSuite(java.lang.String);
    method public void addTest(junit.framework.Test);
    method public void addTestSuite(java.lang.Class);
    method public void addTestSuite(java.lang.Class<? extends junit.framework.TestCase>);
    method public int countTestCases();
    method public static junit.framework.Test createTest(java.lang.Class, java.lang.String);
    method public static junit.framework.Test createTest(java.lang.Class<?>, java.lang.String);
    method public java.lang.String getName();
    method public static java.lang.reflect.Constructor getTestConstructor(java.lang.Class) throws java.lang.NoSuchMethodException;
    method public static java.lang.reflect.Constructor<?> getTestConstructor(java.lang.Class) throws java.lang.NoSuchMethodException;
    method public void run(junit.framework.TestResult);
    method public void runTest(junit.framework.Test, junit.framework.TestResult);
    method public void setName(java.lang.String);
    method public junit.framework.Test testAt(int);
    method public int testCount();
    method public java.util.Enumeration tests();
    method public java.util.Enumeration<junit.framework.Test> tests();
  }
}
@@ -41946,7 +41946,7 @@ package junit.runner {
    method protected static java.util.Properties getPreferences();
    method public junit.framework.Test getTest(java.lang.String);
    method public static boolean inVAJava();
    method protected java.lang.Class loadSuiteClass(java.lang.String) throws java.lang.ClassNotFoundException;
    method protected java.lang.Class<?> loadSuiteClass(java.lang.String) throws java.lang.ClassNotFoundException;
    method protected java.lang.String processArguments(java.lang.String[]);
    method protected abstract void runFailed(java.lang.String);
    method public static void savePreferences() throws java.io.IOException;
+24 −14
Original line number Diff line number Diff line
@@ -19697,12 +19697,12 @@ package android.test {
    method public final void testApplicationTestCaseSetUpProperly() throws java.lang.Exception;
  }
  public class AssertionFailedError extends java.lang.Error {
  public deprecated class AssertionFailedError extends java.lang.Error {
    ctor public AssertionFailedError();
    ctor public AssertionFailedError(java.lang.String);
  }
  public class ComparisonFailure extends android.test.AssertionFailedError {
  public deprecated class ComparisonFailure extends android.test.AssertionFailedError {
    ctor public ComparisonFailure(java.lang.String, java.lang.String, java.lang.String);
  }
@@ -19744,6 +19744,7 @@ package android.test {
    ctor public InstrumentationTestSuite(android.app.Instrumentation);
    ctor public InstrumentationTestSuite(java.lang.String, android.app.Instrumentation);
    ctor public InstrumentationTestSuite(java.lang.Class, android.app.Instrumentation);
    method public void addTestSuite(java.lang.Class);
  }
  public class IsolatedContext extends android.content.ContextWrapper {
@@ -42498,15 +42499,21 @@ package junit.framework {
    method public static void assertTrue(boolean);
    method public static void fail(java.lang.String);
    method public static void fail();
    method public static void failNotEquals(java.lang.String, java.lang.Object, java.lang.Object);
    method public static void failNotSame(java.lang.String, java.lang.Object, java.lang.Object);
    method public static void failSame(java.lang.String);
    method public static java.lang.String format(java.lang.String, java.lang.Object, java.lang.Object);
  }
  public class AssertionFailedError extends java.lang.Error {
  public class AssertionFailedError extends java.lang.AssertionError {
    ctor public AssertionFailedError();
    ctor public AssertionFailedError(java.lang.String);
  }
  public class ComparisonFailure extends junit.framework.AssertionFailedError {
    ctor public ComparisonFailure(java.lang.String, java.lang.String, java.lang.String);
    method public java.lang.String getActual();
    method public java.lang.String getExpected();
  }
  public abstract interface Protectable {
@@ -42558,9 +42565,9 @@ package junit.framework {
    method public synchronized void addListener(junit.framework.TestListener);
    method public void endTest(junit.framework.Test);
    method public synchronized int errorCount();
    method public synchronized java.util.Enumeration errors();
    method public synchronized java.util.Enumeration<junit.framework.TestFailure> errors();
    method public synchronized int failureCount();
    method public synchronized java.util.Enumeration failures();
    method public synchronized java.util.Enumeration<junit.framework.TestFailure> failures();
    method public synchronized void removeListener(junit.framework.TestListener);
    method protected void run(junit.framework.TestCase);
    method public synchronized int runCount();
@@ -42577,21 +42584,24 @@ package junit.framework {
  public class TestSuite implements junit.framework.Test {
    ctor public TestSuite();
    ctor public TestSuite(java.lang.Class, java.lang.String);
    ctor public TestSuite(java.lang.Class);
    ctor public TestSuite(java.lang.Class<?>);
    ctor public TestSuite(java.lang.Class<? extends junit.framework.TestCase>, java.lang.String);
    ctor public TestSuite(java.lang.String);
    ctor public TestSuite(java.lang.Class<?>...);
    ctor public TestSuite(java.lang.Class<? extends junit.framework.TestCase>[], java.lang.String);
    method public void addTest(junit.framework.Test);
    method public void addTestSuite(java.lang.Class);
    method public void addTestSuite(java.lang.Class<? extends junit.framework.TestCase>);
    method public int countTestCases();
    method public static junit.framework.Test createTest(java.lang.Class, java.lang.String);
    method public static junit.framework.Test createTest(java.lang.Class<?>, java.lang.String);
    method public java.lang.String getName();
    method public static java.lang.reflect.Constructor getTestConstructor(java.lang.Class) throws java.lang.NoSuchMethodException;
    method public static java.lang.reflect.Constructor<?> getTestConstructor(java.lang.Class<?>) throws java.lang.NoSuchMethodException;
    method public void run(junit.framework.TestResult);
    method public void runTest(junit.framework.Test, junit.framework.TestResult);
    method public void setName(java.lang.String);
    method public junit.framework.Test testAt(int);
    method public int testCount();
    method public java.util.Enumeration tests();
    method public java.util.Enumeration<junit.framework.Test> tests();
    method public static junit.framework.Test warning(java.lang.String);
  }
}
@@ -42608,13 +42618,13 @@ package junit.runner {
    method public java.lang.String extractClassName(java.lang.String);
    method public static java.lang.String getFilteredTrace(java.lang.Throwable);
    method public static java.lang.String getFilteredTrace(java.lang.String);
    method public junit.runner.TestSuiteLoader getLoader();
    method public deprecated junit.runner.TestSuiteLoader getLoader();
    method public static java.lang.String getPreference(java.lang.String);
    method public static int getPreference(java.lang.String, int);
    method protected static java.util.Properties getPreferences();
    method public junit.framework.Test getTest(java.lang.String);
    method public static boolean inVAJava();
    method protected java.lang.Class loadSuiteClass(java.lang.String) throws java.lang.ClassNotFoundException;
    method public static deprecated boolean inVAJava();
    method protected java.lang.Class<?> loadSuiteClass(java.lang.String) throws java.lang.ClassNotFoundException;
    method protected java.lang.String processArguments(java.lang.String[]);
    method protected abstract void runFailed(java.lang.String);
    method public static void savePreferences() throws java.io.IOException;
+1 −2
Original line number Diff line number Diff line
@@ -19,8 +19,7 @@ package android.test;
/**
 * Thrown when an assertion failed.
 * 
 * Note:  Most users of this class should simply use junit.framework.AssertionFailedError,
 * which provides the same functionality.
 * @deprecated use junit.framework.AssertionFailedError
 */
public class AssertionFailedError extends Error {
    
+1 −2
Original line number Diff line number Diff line
@@ -19,8 +19,7 @@ package android.test;
/**
 * Thrown when an assert equals for Strings failed.
 * 
 * Note:  Most users of this class should simply use junit.framework.ComparisonFailure,
 * which provides the same functionality at a lighter weight.
 * @deprecated use junit.framework.ComparisonFailure
 */
public class ComparisonFailure extends AssertionFailedError {
    private junit.framework.ComparisonFailure mComparison;
+85 −69
Original line number Diff line number Diff line
package junit.runner;

import junit.framework.*;
import java.lang.reflect.*;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringReader;
import java.io.StringWriter;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.text.NumberFormat;
import java.io.*;
import java.util.*;
import java.util.Properties;

import junit.framework.AssertionFailedError;
import junit.framework.Test;
import junit.framework.TestListener;
import junit.framework.TestSuite;

/**
 * Base class for all test runners.
@@ -48,8 +62,9 @@ public abstract class BaseTestRunner implements TestListener {
        }
    }

    // android-changed remove 'static' qualifier for API compatibility
    public void setPreference(String key, String value) {
        getPreferences().setProperty(key, value);
        getPreferences().put(key, value);
    }

    public synchronized void endTest(Test test) {
@@ -108,7 +123,7 @@ public abstract class BaseTestRunner implements TestListener {
        }
        Test test= null;
        try {
            test= (Test)suiteMethod.invoke(null); // static method
            test= (Test)suiteMethod.invoke(null, (Object[])new Class[0]); // static method
            if (test == null)
                return test;
        }
@@ -163,7 +178,7 @@ public abstract class BaseTestRunner implements TestListener {
        fLoading= enable;
    }
    /**
     * Extract the class name from a String
     * Extract the class name from a String in VA/Java style
     */
    public String extractClassName(String className) {
        if(className.startsWith("Default package for"))
@@ -186,30 +201,34 @@ public abstract class BaseTestRunner implements TestListener {
     */
    protected abstract void runFailed(String message);

    // BEGIN android-changed - add back getLoader() for API compatibility
    /**
     * Returns the loaded Class for a suite name.
     * Returns the loader to be used.
     * 
     * @deprecated not present in JUnit4.10
     */
    protected Class loadSuiteClass(String suiteClassName) throws ClassNotFoundException {
        return getLoader().load(suiteClassName);
    public TestSuiteLoader getLoader() {
        if (useReloadingTestSuiteLoader())
            return new ReloadingTestSuiteLoader();
        return new StandardTestSuiteLoader();
    }
    // END android-changed

    /**
     * Clears the status message.
     * Returns the loaded Class for a suite name.
     */
    protected void clearStatus() { // Belongs in the GUI TestRunner class
    protected Class<?> loadSuiteClass(String suiteClassName) throws ClassNotFoundException {
        return Class.forName(suiteClassName);
    }

    /**
     * Returns the loader to be used.
     * Clears the status message.
     */
    public TestSuiteLoader getLoader() {
        if (useReloadingTestSuiteLoader())
            return new ReloadingTestSuiteLoader();
        return new StandardTestSuiteLoader();
    protected void clearStatus() { // Belongs in the GUI TestRunner class
    }

    protected boolean useReloadingTestSuiteLoader() {
        return getPreference("loading").equals("true") && !inVAJava() && fLoading;
        return getPreference("loading").equals("true") && fLoading;
    }

    private static File getPreferencesFile() {
@@ -248,16 +267,6 @@ public abstract class BaseTestRunner implements TestListener {
        return intValue;
    }

     public static boolean inVAJava() {
        try {
            Class.forName("com.ibm.uvm.tools.DebugSupport");
        }
        catch (Exception e) {
            return false;
        }
        return true;
    }

    /**
     * Returns a filtered stack trace
     */
@@ -270,6 +279,13 @@ public abstract class BaseTestRunner implements TestListener {
        return BaseTestRunner.getFilteredTrace(trace);
    }

    // BEGIN android-changed - add back this method for API compatibility
    /** @deprecated not present in JUnit4.10 */
    public static boolean inVAJava() {
        return false;
    }
    // END android-changed

    /**
     * Filters stack frames from internal JUnit classes
     */
Loading