本文整理汇总了Java中android.test.AndroidTestCase类的典型用法代码示例。如果您正苦于以下问题:Java AndroidTestCase类的具体用法?Java AndroidTestCase怎么用?Java AndroidTestCase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AndroidTestCase类属于android.test包,在下文中一共展示了AndroidTestCase类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: assertEquals
import android.test.AndroidTestCase; //导入依赖的package包/类
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));
}
}
示例2: run
import android.test.AndroidTestCase; //导入依赖的package包/类
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();
}
}
示例3: testContext
import android.test.AndroidTestCase; //导入依赖的package包/类
/**
* @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;
}
示例4: AndroidTestCaseInitializationStrategy
import android.test.AndroidTestCase; //导入依赖的package包/类
public AndroidTestCaseInitializationStrategy(AndroidTestCase testCase) {
this.testCase = testCase;
}
示例5: runAndWaitForEnd
import android.test.AndroidTestCase; //导入依赖的package包/类
public static void runAndWaitForEnd(AndroidTestCase testCase, int timeoutMilis, AsyncBlockRunner asyncBlockRunner) throws Exception {
new AsyncTimeoutHelper(timeoutMilis,asyncBlockRunner).run();
}