本文整理匯總了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();
}