use of com.pushtorefresh.storio.operations.PreparedWriteOperation 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 com.pushtorefresh.storio.operations.PreparedWriteOperation in project storio by pushtorefresh.
the class OnSubscribeExecuteAsBlockingCompletableTest method shouldExecuteAsBlockingAfterSubscription.
@SuppressWarnings("ResourceType")
@Test
public void shouldExecuteAsBlockingAfterSubscription() {
final PreparedWriteOperation preparedOperation = mock(PreparedWriteOperation.class);
TestSubscriber testSubscriber = new TestSubscriber();
verifyZeroInteractions(preparedOperation);
Completable completable = Completable.create(OnSubscribeExecuteAsBlockingCompletable.newInstance(preparedOperation));
verifyZeroInteractions(preparedOperation);
completable.subscribe(testSubscriber);
testSubscriber.assertNoErrors();
testSubscriber.assertCompleted();
verify(preparedOperation).executeAsBlocking();
verify(preparedOperation, never()).asRxObservable();
verify(preparedOperation, never()).asRxSingle();
verify(preparedOperation, never()).asRxCompletable();
}
Aggregations