类android.test.suitebuilder.annotation.SmallTest源码实例Demo

下面列出了怎么用android.test.suitebuilder.annotation.SmallTest的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: barber   文件: BarberTest.java
@SmallTest
public void testColorStateList() {
    int defaultColor = res.getColor(android.R.color.holo_blue_bright);
    int pressedColor = res.getColor(android.R.color.holo_blue_dark);
    int[] pressedState = {android.R.attr.state_pressed};
    int[] defaultState = {};

    assertNotNull(testView.testColorStateList);
    assertTrue(testView.testColorStateList.isStateful());
    assertEquals(pressedColor, testView.testColorStateList.getColorForState(pressedState, defaultColor));
    assertEquals(defaultColor, testView.testColorStateList.getColorForState(defaultState, defaultColor));

    assertNotNull(defaultsTestView.testColorStateList);
    assertTrue(defaultsTestView.testColorStateList.isStateful());
    assertEquals(pressedColor, defaultsTestView.testColorStateList.getColorForState(pressedState, defaultColor));
    assertEquals(defaultColor, defaultsTestView.testColorStateList.getColorForState(defaultState, defaultColor));
}
 
源代码2 项目: StoreBox   文件: ChangesListenersTestCase.java
@UiThreadTest
@SmallTest
public void testCustomClassChangedNull() {
    final AtomicReference<CustomClass> value = new AtomicReference<>();
    final OnPreferenceValueChangedListener<CustomClass> listener =
            new OnPreferenceValueChangedListener<CustomClass>() {
                @Override
                public void onChanged(CustomClass newValue) {
                    value.set(newValue);
                }
            };
    
    uut.setCustomClass(new CustomClass("a", "b"));
    uut.registerCustomClassChangeListener(listener);
    uut.setCustomClass(null);
    
    assertNull(value.get());
}
 
源代码3 项目: Chronos   文件: FragmentRunTest.java
@SmallTest
public void testNormalRunTaggedSequential() {
    final SimpleMockActivity activity = new SimpleMockActivity();
    final SimpleMockFragment fragment = new SimpleMockFragment();
    activity.addFragment(fragment);

    activity.start();
    final int firstRunId = fragment.runSimpleTagged(INPUT);
    sleep();
    assertTrue(fragment.getResultObtained() == 1);
    assertTrue(SimpleOperation.isTransform(INPUT, fragment.getResult()));
    assertNull(fragment.getError());

    final int secondRunId = fragment.runSimpleTagged(INPUT);
    assertTrue(firstRunId != secondRunId);
    sleep();
    assertTrue(fragment.getResultObtained() == 2);
    assertTrue(SimpleOperation.isTransform(INPUT, fragment.getResult()));
    assertNull(fragment.getError());
}
 
源代码4 项目: rxsnappy   文件: TimeBasedCacheTest.java
@SmallTest
public void testDataCacheIsValid() throws SnappydbException {
    String key = "asd";

    DummyData dummyData = DataGenerator.generateNewDummyData();

    rxSnappyClient.setObject(key, dummyData)
            .toBlocking().first();

    try {
        Thread.sleep(2500L);
    } catch (InterruptedException e) {

    }

    DummyData actual = rxSnappyClient.getObject(key, 5000L, DummyData.class)
            .toBlocking().first();

    assertEquals(dummyData, actual);
}
 
源代码5 项目: StoreBox   文件: ChangesListenersTestCase.java
@UiThreadTest
@SmallTest
public void testIntChanged() {
    final AtomicInteger value = new AtomicInteger(-1);
    final OnPreferenceValueChangedListener<Integer> listener =
            new OnPreferenceValueChangedListener<Integer>() {
                @Override
                public void onChanged(Integer newValue) {
                    value.set(newValue);
                }
            };
    
    uut.registerIntChangeListener(listener);
    uut.setInt(1);
    
    assertEquals(1, value.get());
}
 
源代码6 项目: Chronos   文件: FragmentRunTest.java
@SmallTest
public void testRelaunchCancelledTaggedRunByTag() {
    final SimpleMockActivity activity = new SimpleMockActivity();
    final SimpleMockFragment fragment = new SimpleMockFragment();
    activity.addFragment(fragment);

    activity.start();
    final int firstRunId = fragment.runSimpleTagged(INPUT);
    final boolean cancelResult = fragment.cancelTagged();
    assertTrue(cancelResult);

    final int secondRunId = fragment.runSimpleTagged(INPUT);
    assertTrue(firstRunId != secondRunId);
    sleep();
    assertTrue(fragment.getResultObtained() == 1);
    assertTrue(SimpleOperation.isTransform(INPUT, fragment.getResult()));
    assertNull(fragment.getError());
}
 
源代码7 项目: Chronos   文件: ActivityRunTest.java
@SmallTest
public void testNormalRunTaggedSequential() {
    final SimpleMockActivity activity = new SimpleMockActivity();
    activity.start();
    final int firstRunId = activity.runSimpleTagged(INPUT);
    sleep();
    assertTrue(activity.getResultObtained() == 1);
    assertTrue(SimpleOperation.isTransform(INPUT, activity.getResult()));
    assertNull(activity.getError());

    final int secondRunId = activity.runSimpleTagged(INPUT);
    assertTrue(firstRunId != secondRunId);
    sleep();
    assertTrue(activity.getResultObtained() == 2);
    assertTrue(SimpleOperation.isTransform(INPUT, activity.getResult()));
    assertNull(activity.getError());
}
 
源代码8 项目: Chronos   文件: FragmentRunTest.java
@SmallTest
public void testNormalRunRotateTagged() {
    final SimpleMockActivity activity = new SimpleMockActivity();
    final SimpleMockFragment fragment = new SimpleMockFragment();
    activity.addFragment(fragment);

    activity.start();
    final int firstRunId = fragment.runSimpleTagged(INPUT);
    activity.stop();
    activity.start();
    final int secondRunId = fragment.runSimpleTagged(INPUT);
    assertTrue(firstRunId == secondRunId);
    sleep();
    assertTrue(fragment.getResultObtained() == 1);
    assertTrue(SimpleOperation.isTransform(INPUT, fragment.getResult()));
    assertNull(fragment.getError());
}
 
源代码9 项目: StoreBox   文件: KeysAndDefaultValuesTestCase.java
@SmallTest
public void testKeyByResource() {
    uut.getValueAlt();
    verify(prefs).getString(eq("string"), any(String.class));
    
    uut.setValueAlt("value");
    verify(editor).putString(eq("string"), any(String.class));
}
 
源代码10 项目: Chronos   文件: SetupTest.java
@SmallTest
public void testActivityLifecycleInvalid1() {
    final MockActivity activity = new SimpleMockActivity();

    IllegalStateException exception = null;
    try {
        activity.stop();
    } catch (IllegalStateException e) {
        exception = e;
    }
    Assert.assertNotNull(exception);
}
 
源代码11 项目: rxsnappy   文件: BasicOperationTest.java
@SmallTest
public void testSaveNullBoolean() throws Exception {
    boolean isExceptionThrown = false;

    try {
        rxSnappyClient.setBoolean(test_key, null)
                .toBlocking().first();
    } catch (RxSnappyException ex) {
        isExceptionThrown = true;
    }
    assertEquals(true, isExceptionThrown);
}
 
源代码12 项目: Chronos   文件: ActivityRunTest.java
@SmallTest
public void testNormalRunRotate() {
    final SimpleMockActivity activity = new SimpleMockActivity();
    activity.start();
    activity.runSimple(INPUT);
    activity.stop();
    sleep();
    activity.start();
    assertTrue(activity.getResultObtained() == 1);
    assertTrue(SimpleOperation.isTransform(INPUT, activity.getResult()));
    assertNull(activity.getError());
}
 
源代码13 项目: rxsnappy   文件: BasicOperationTest.java
@SmallTest
public void testBooleanMissingFromCache() throws Exception {
    boolean isExceptionThrown = false;

    try {
        rxSnappyClient.getBoolean("test123")
                .toBlocking().first();
    } catch (RxSnappyException ex) {
        isExceptionThrown = true;
    }
    assertEquals(true, isExceptionThrown);
}
 
源代码14 项目: StoreBox   文件: ForwardingMethodsTestCase.java
@SmallTest
public void testEditorMethodsForwarded() {
    uut.putString("key", "value");
    uut.apply();

    verify(editor).putString(eq("key"), eq("value"));
    verify(editor).apply();
}
 
源代码15 项目: rxsnappy   文件: BasicOperationTest.java
@SmallTest
public void testSaveNullString() throws Exception {
    boolean isExceptionThrown = false;

    try {
        rxSnappyClient.setString(test_key, null)
                .toBlocking().first();
    } catch (RxSnappyException ex) {
        isExceptionThrown = true;
    }
    assertEquals(true, isExceptionThrown);
}
 
源代码16 项目: rxsnappy   文件: BasicOperationTest.java
@SmallTest
public void testSaveNullKeyString() throws Exception {
    boolean isExceptionThrown = false;

    try {
        rxSnappyClient.setString(null, "asd")
                .toBlocking().first();
    } catch (RxSnappyException ex) {
        isExceptionThrown = true;
    }
    assertEquals(true, isExceptionThrown);
}
 
源代码17 项目: rxsnappy   文件: BasicOperationTest.java
@SmallTest
public void testStringMissingFromCache() throws Exception {
    boolean isExceptionThrown = false;

    try {
        rxSnappyClient.getString("test123")
                .toBlocking().first();
    } catch (RxSnappyException ex) {
        isExceptionThrown = true;
    }
    assertEquals(true, isExceptionThrown);
}
 
源代码18 项目: Chronos   文件: ActivityRunTest.java
@SmallTest
public void testCancelRunTaggedById() {
    final SimpleMockActivity activity = new SimpleMockActivity();
    activity.start();
    final int runId = activity.runSimpleTagged(INPUT);
    final boolean cancelResult = activity.cancel(runId);
    assertTrue(cancelResult);
    sleep();
    assertFalse(activity.gotResult());
}
 
源代码19 项目: Chronos   文件: FragmentRunTest.java
@SmallTest
public void testCancelRunRotate() {
    final SimpleMockActivity activity = new SimpleMockActivity();
    final SimpleMockFragment fragment = new SimpleMockFragment();
    activity.addFragment(fragment);

    activity.start();
    final int runId = fragment.runSimple(INPUT);
    final boolean cancelResult = fragment.cancel(runId);
    assertTrue(cancelResult);
    activity.stop();
    sleep();
    activity.start();
    assertFalse(fragment.gotResult());
}
 
源代码20 项目: barber   文件: BarberTest.java
@SmallTest
public void testFraction() {
    assertEquals(res.getFraction(R.fraction.fraction, 2, 2), testView.testFractionBase);
    assertEquals(res.getFraction(R.fraction.parent_fraction, 2, 2), testView.testFracionPBase);
    assertEquals(res.getFraction(R.fraction.fraction, 2, 2), defaultsTestView.testFractionBase);
    assertEquals(res.getFraction(R.fraction.parent_fraction, 2, 2), defaultsTestView.testFracionPBase);
}
 
源代码21 项目: rxsnappy   文件: BasicOperationTest.java
@SmallTest
public void testSaveNullInteger() throws Exception {
    boolean isExceptionThrown = false;

    try {
        rxSnappyClient.setInteger(test_key, null)
                .toBlocking().first();
    } catch (RxSnappyException ex) {
        isExceptionThrown = true;
    }
    assertEquals(true, isExceptionThrown);
}
 
源代码22 项目: Chronos   文件: ActivityRunTest.java
@SmallTest
public void testCancelRunTaggedByTag() {
    final SimpleMockActivity activity = new SimpleMockActivity();
    activity.start();
    activity.runSimpleTagged(INPUT);
    final boolean cancelResult = activity.cancelTagged();
    assertTrue(cancelResult);
    sleep();
    assertFalse(activity.gotResult());
}
 
源代码23 项目: rxsnappy   文件: BasicOperationTest.java
@SmallTest
public void testSaveNullStringList() throws Exception {
    boolean isExceptionThrown = false;

    try {
        rxSnappyClient.setStringList(test_key, null)
                .toBlocking().first();
    } catch (RxSnappyException ex) {
        isExceptionThrown = true;
    }
    assertEquals(true, isExceptionThrown);
}
 
源代码24 项目: rxsnappy   文件: BasicOperationTest.java
@SmallTest
public void testStringListMissingFromCache() throws Exception {
    boolean isExceptionThrown = false;

    try {
        rxSnappyClient.getStringList("test123")
                .toBlocking().first();
    } catch (RxSnappyException ex) {
        isExceptionThrown = true;
    }
    assertEquals(true, isExceptionThrown);
}
 
源代码25 项目: Chronos   文件: FragmentRunTest.java
@SmallTest
public void testCancelAfterRun() {
    final SimpleMockActivity activity = new SimpleMockActivity();
    final SimpleMockFragment fragment = new SimpleMockFragment();
    activity.addFragment(fragment);

    activity.start();
    final int runId = fragment.runSimple(INPUT);
    sleep();
    final boolean cancelResult = fragment.cancel(runId);
    assertFalse(cancelResult);
    assertTrue(fragment.gotResult());
}
 
源代码26 项目: rxsnappy   文件: BasicOperationTest.java
@SmallTest
public void testSaveNullKeyObjectList() throws Exception {
    boolean isExceptionThrown = false;

    try {
        rxSnappyClient.setList(null, DataGenerator.dummyDataGenerator(3))
                .toBlocking().first();
    } catch (RxSnappyException ex) {
        isExceptionThrown = true;
    }
    assertEquals(true, isExceptionThrown);
}
 
源代码27 项目: rxsnappy   文件: BasicOperationTest.java
@SmallTest
public void testSaveNullObjectList() throws Exception {
    boolean isExceptionThrown = false;

    try {
        rxSnappyClient.setList(test_key, null)
                .toBlocking().first();
    } catch (RxSnappyException ex) {
        isExceptionThrown = true;
    }
    assertEquals(true, isExceptionThrown);
}
 
源代码28 项目: rxsnappy   文件: BasicOperationTest.java
@SmallTest
public void testObjectListMissingFromCache() throws Exception {
    boolean isExceptionThrown = false;

    try {
        rxSnappyClient.getList("test123", DummyData.class)
                .toBlocking().first();
    } catch (RxSnappyException ex) {
        isExceptionThrown = true;
    }
    assertEquals(true, isExceptionThrown);
}
 
源代码29 项目: rxsnappy   文件: BasicOperationTest.java
@SmallTest
public void testSaveNullObject() throws Exception {
    boolean isExceptionThrown = false;

    try {
        rxSnappyClient.setObject(test_key, null)
                .toBlocking().first();
    } catch (RxSnappyException ex) {
        isExceptionThrown = true;
    }
    assertEquals(true, isExceptionThrown);
}
 
源代码30 项目: Chronos   文件: FragmentRunTest.java
@SmallTest
public void testCancelRunTaggedByTag() {
    final SimpleMockActivity activity = new SimpleMockActivity();
    final SimpleMockFragment fragment = new SimpleMockFragment();
    activity.addFragment(fragment);

    activity.start();
    fragment.runSimpleTagged(INPUT);
    final boolean cancelResult = fragment.cancelTagged();
    assertTrue(cancelResult);
    sleep();
    assertFalse(fragment.gotResult());
}