use of rx.Completable in project storio by pushtorefresh.
the class OnSubscribeExecuteAsBlockingCompletableTest method shouldCallOnErrorIfExceptionOccurred.
@SuppressWarnings({ "ThrowableInstanceNeverThrown", "ResourceType" })
@Test
public void shouldCallOnErrorIfExceptionOccurred() {
final PreparedWriteOperation preparedOperation = mock(PreparedWriteOperation.class);
StorIOException expectedException = new StorIOException("test exception");
when(preparedOperation.executeAsBlocking()).thenThrow(expectedException);
TestSubscriber testSubscriber = new TestSubscriber();
Completable completable = Completable.create(OnSubscribeExecuteAsBlockingCompletable.newInstance(preparedOperation));
verifyZeroInteractions(preparedOperation);
completable.subscribe(testSubscriber);
testSubscriber.assertError(expectedException);
testSubscriber.assertTerminalEvent();
verify(preparedOperation).executeAsBlocking();
verify(preparedOperation, never()).asRxObservable();
verify(preparedOperation, never()).asRxSingle();
verify(preparedOperation, never()).asRxCompletable();
}
use of rx.Completable in project storio by pushtorefresh.
the class PreparedDeleteByQueryTest method shouldDeleteByQueryAsCompletable.
@Test
public void shouldDeleteByQueryAsCompletable() {
final DeleteByQueryStub deleteStub = DeleteByQueryStub.newInstance();
final Completable completable = deleteStub.storIOContentResolver.delete().byQuery(deleteStub.deleteQuery).withDeleteResolver(deleteStub.deleteResolver).prepare().asRxCompletable();
deleteStub.verifyBehavior(completable);
}
use of rx.Completable in project storio by pushtorefresh.
the class RxJavaUtils method createCompletable.
@CheckResult
@NonNull
public static <T> Completable createCompletable(@NonNull StorIOSQLite storIOSQLite, @NonNull PreparedOperation<T> operation) {
throwExceptionIfRxJavaIsNotAvailable("asRxCompletable()");
final Completable completable = Completable.create(OnSubscribeExecuteAsBlockingCompletable.newInstance(operation));
return subscribeOn(storIOSQLite, completable);
}
use of rx.Completable in project storio by pushtorefresh.
the class DeleteOperationDesignTest method deleteCollectionOfObjectsCompletable.
@Test
public void deleteCollectionOfObjectsCompletable() {
List<User> users = new ArrayList<User>();
Completable completableDelete = storIOSQLite().delete().objects(users).withDeleteResolver(UserTableMeta.DELETE_RESOLVER).prepare().asRxCompletable();
}
use of rx.Completable in project storio by pushtorefresh.
the class PutOperationDesignTest method putObjectCompletable.
@Test
public void putObjectCompletable() {
User user = newUser();
Completable completablePut = storIOSQLite().put().object(user).withPutResolver(UserTableMeta.PUT_RESOLVER).prepare().asRxCompletable();
}
Aggregations