Search in sources :

Example 46 with TestSubscriber

use of rx.observers.TestSubscriber in project frodo by android10.

the class FrodoObservableTest method setUp.

@Before
public void setUp() {
    frodoObservable = new FrodoObservable(observableRule.joinPoint(), messageManager, observableFactory);
    subscriber = new TestSubscriber();
    given(observableFactory.create(any(Annotation.class))).willReturn(createLogEverythingObservable());
}
Also used : TestSubscriber(rx.observers.TestSubscriber) Annotation(java.lang.annotation.Annotation) Before(org.junit.Before)

Example 47 with TestSubscriber

use of rx.observers.TestSubscriber in project frodo by android10.

the class LogSchedulersObservableTest method setUp.

@Before
public void setUp() {
    subscriber = new TestSubscriber();
    loggableObservable = new LogSchedulersObservable(observableRule.joinPoint(), messageManager, observableRule.info());
}
Also used : TestSubscriber(rx.observers.TestSubscriber) Before(org.junit.Before)

Example 48 with TestSubscriber

use of rx.observers.TestSubscriber in project greenDAO by greenrobot.

the class RxDaoTest method assertDeleted.

private void assertDeleted(Observable<Void> observable) {
    TestSubscriber testSubscriber = RxTestHelper.awaitTestSubscriber(observable);
    assertEquals(1, testSubscriber.getValueCount());
    assertNull(testSubscriber.getOnNextEvents().get(0));
    assertEquals(0, dao.count());
}
Also used : TestSubscriber(rx.observers.TestSubscriber)

Example 49 with TestSubscriber

use of rx.observers.TestSubscriber in project greenDAO by greenrobot.

the class RxDaoTest method testUpdate.

public void testUpdate() {
    TestEntity foo = insertEntity("foo");
    foo.setSimpleString("foofoo");
    TestSubscriber testSubscriber = RxTestHelper.awaitTestSubscriber(rxDao.update(foo));
    assertEquals(1, testSubscriber.getValueCount());
    assertSame(foo, testSubscriber.getOnNextEvents().get(0));
    List<TestEntity> testEntities = dao.loadAll();
    assertEquals(1, testEntities.size());
    assertNotSame(foo, testEntities.get(0));
    assertEquals("foofoo", testEntities.get(0).getSimpleString());
}
Also used : TestEntity(org.greenrobot.greendao.daotest.TestEntity) TestSubscriber(rx.observers.TestSubscriber)

Example 50 with TestSubscriber

use of rx.observers.TestSubscriber in project sqlbrite by square.

the class SqlBriteTest method asRowsEmptyWhenNullCursor.

@Test
public void asRowsEmptyWhenNullCursor() {
    Query nully = new Query() {

        @Nullable
        @Override
        public Cursor run() {
            return null;
        }
    };
    TestSubscriber<Name> subscriber = new TestSubscriber<>();
    final AtomicInteger count = new AtomicInteger();
    nully.asRows(new Func1<Cursor, Name>() {

        @Override
        public Name call(Cursor cursor) {
            count.incrementAndGet();
            return Name.MAP.call(cursor);
        }
    }).subscribe(subscriber);
    subscriber.assertNoValues();
    subscriber.assertCompleted();
    assertThat(count.get()).isEqualTo(0);
}
Also used : Query(com.squareup.sqlbrite.SqlBrite.Query) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) TestSubscriber(rx.observers.TestSubscriber) Func1(rx.functions.Func1) MatrixCursor(android.database.MatrixCursor) Cursor(android.database.Cursor) Test(org.junit.Test)

Aggregations

TestSubscriber (rx.observers.TestSubscriber)238 Test (org.junit.Test)213 Intent (android.content.Intent)48 Environment (com.kickstarter.libs.Environment)43 Cursor (android.database.Cursor)36 Changes (com.pushtorefresh.storio.contentresolver.Changes)34 Project (com.kickstarter.models.Project)33 MockCurrentUser (com.kickstarter.libs.MockCurrentUser)21 MockApiClient (com.kickstarter.services.MockApiClient)21 ApiClientType (com.kickstarter.services.ApiClientType)20 TargetApi (android.annotation.TargetApi)18 CurrentUserType (com.kickstarter.libs.CurrentUserType)18 StorIOSQLite (com.pushtorefresh.storio.sqlite.StorIOSQLite)18 StorIOException (com.pushtorefresh.storio.StorIOException)17 TestCollapserTimer (com.netflix.hystrix.HystrixCollapserTest.TestCollapserTimer)16 Matchers.anyString (org.mockito.Matchers.anyString)16 User (com.kickstarter.models.User)15 PutResult (com.pushtorefresh.storio.contentresolver.operations.put.PutResult)15 Uri (android.net.Uri)14 NonNull (android.support.annotation.NonNull)14