Java 类android.test.AndroidTestCase 实例源码

项目:devbricks    文件:Asserts.java   
public static void assertEquals(Adapter expected, Adapter actual) {
    AndroidTestCase.assertNotNull(actual);

    if (expected == null) {
        AndroidTestCase.assertEquals(0, actual.getCount());
        return;
    }

    AndroidTestCase.assertEquals(expected.getCount(), actual.getCount());

    final int count = expected.getCount();
    for (int i = 0; i < count; i++) {
        AndroidTestCase.assertEquals(
                expected.getItem(i), actual.getItem(i));
    }
}
项目:ggarest    文件:AsyncTimeoutHelper.java   
private void run() throws Exception {
    asyncBlockRunner.run(this);

    if(latch.await(timeoutMilis, TimeUnit.MILLISECONDS)){
        if(failMessage==null) {
            if(assertions!=null){
                assertions.run();
            }
            asyncBlockRunner.onEndCalled();
        }
        else{
            AndroidTestCase.fail(failMessage);
        }
    }
    else {
        asyncBlockRunner.onTimeout();
    }
}
项目:devbricks    文件:Asserts.java   
public static void assertEquals(List<?> expected, List<?> actual) {
    AndroidTestCase.assertNotNull(actual);

    if (expected == null) {
        AndroidTestCase.assertEquals(0, actual.size());
        return;
    }

    AndroidTestCase.assertEquals(expected.size(), actual.size());

    final int count = expected.size();
    for (int i = 0; i < count; i++) {
        AndroidTestCase.assertEquals(expected.get(i), actual.get(i));
    }
}
项目:devbricks    文件:Asserts.java   
public static void assertEquals(byte[] expected, byte[] actual) {
    AndroidTestCase.assertNotNull(actual);

    if (expected == null) {
        AndroidTestCase.assertEquals(0, actual.length);
        return;
    }

    AndroidTestCase.assertEquals(expected.length, actual.length);

    final int count = expected.length;
    for (int i = 0; i < count; i++) {
        AndroidTestCase.assertEquals(expected[i], actual[i]);
    }
}
项目:devbricks    文件:Asserts.java   
public static void assertEquals(long[] expected, long[] actual) {
    AndroidTestCase.assertNotNull(actual);

    if (expected == null) {
        AndroidTestCase.assertEquals(0, actual.length);
        return;
    }

    AndroidTestCase.assertEquals(expected.length, actual.length);

    final int count = expected.length;
    for (int i = 0; i < count; i++) {
        AndroidTestCase.assertEquals(expected[i], actual[i]);
    }
}
项目:devbricks    文件:Asserts.java   
public static void assertEquals(int[] expected, int[] actual) {
    AndroidTestCase.assertNotNull(actual);

    if (expected == null) {
        AndroidTestCase.assertEquals(0, actual.length);
        return;
    }

    AndroidTestCase.assertEquals(expected.length, actual.length);

    final int count = expected.length;
    for (int i = 0; i < count; i++) {
        AndroidTestCase.assertEquals(expected[i], actual[i]);
    }
}
项目:devbricks    文件:Asserts.java   
public static void assertEquals(Object[] expected, Object[] actual) {
    AndroidTestCase.assertNotNull(actual);

    if (expected == null) {
        AndroidTestCase.assertEquals(0, actual.length);
        return;
    }

    AndroidTestCase.assertEquals(expected.length, actual.length);

    final int count = expected.length;
    for (int i = 0; i < count; i++) {
        AndroidTestCase.assertEquals(expected[i], actual[i]);
    }
}
项目:mobile-connector-sdk-android    文件:BaseAndroidTest.java   
/**
 * @return The {@link Context} of the test project.
 */
protected Context testContext() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
    if (testContext == null) {
        Method getTestContext = AndroidTestCase.class.getMethod("getTestContext");
        testContext = (Context) getTestContext.invoke(this);
    }
    return testContext;
}
项目:injected-test-runner    文件:AndroidTestCaseInitializationStrategy.java   
public AndroidTestCaseInitializationStrategy(AndroidTestCase testCase) {
    this.testCase = testCase;
}
项目:ggarest    文件:AsyncTimeoutHelper.java   
public static void runAndWaitForEnd(AndroidTestCase testCase, int timeoutMilis, AsyncBlockRunner asyncBlockRunner) throws Exception {

        new AsyncTimeoutHelper(timeoutMilis,asyncBlockRunner).run();
    }