use of com.pushtorefresh.storio3.operations.internal.CompletableOnSubscribeExecuteAsBlocking in project storio by pushtorefresh.
the class CompletableOnSubscribeExecuteAsBlockingTest method shouldExecuteAsBlockingAfterSubscription.
@SuppressWarnings("ResourceType")
@Test
public void shouldExecuteAsBlockingAfterSubscription() {
final PreparedCompletableOperation preparedOperation = mock(PreparedCompletableOperation.class);
TestObserver testObserver = new TestObserver();
verifyZeroInteractions(preparedOperation);
Completable completable = Completable.create(new CompletableOnSubscribeExecuteAsBlocking(preparedOperation));
verifyZeroInteractions(preparedOperation);
completable.subscribe(testObserver);
testObserver.assertNoErrors();
testObserver.assertComplete();
verify(preparedOperation).executeAsBlocking();
verify(preparedOperation, never()).asRxFlowable(any(BackpressureStrategy.class));
verify(preparedOperation, never()).asRxSingle();
verify(preparedOperation, never()).asRxCompletable();
}
use of com.pushtorefresh.storio3.operations.internal.CompletableOnSubscribeExecuteAsBlocking in project storio by pushtorefresh.
the class RxJavaUtils method createCompletable.
@CheckResult
@NonNull
public static <Result, Data> Completable createCompletable(@NonNull StorIOContentResolver storIOContentResolver, @NonNull PreparedCompletableOperation<Result, Data> operation) {
throwExceptionIfRxJava2IsNotAvailable("asRxCompletable()");
final Completable completable = Completable.create(new CompletableOnSubscribeExecuteAsBlocking(operation));
return subscribeOn(storIOContentResolver, completable);
}
use of com.pushtorefresh.storio3.operations.internal.CompletableOnSubscribeExecuteAsBlocking in project storio by pushtorefresh.
the class RxJavaUtils method createCompletable.
@CheckResult
@NonNull
public static <T, Data> Completable createCompletable(@NonNull StorIOSQLite storIOSQLite, @NonNull PreparedCompletableOperation<T, Data> operation) {
throwExceptionIfRxJava2IsNotAvailable("asRxCompletable()");
final Completable completable = Completable.create(new CompletableOnSubscribeExecuteAsBlocking(operation));
return subscribeOn(storIOSQLite, completable);
}
use of com.pushtorefresh.storio3.operations.internal.CompletableOnSubscribeExecuteAsBlocking in project storio by pushtorefresh.
the class CompletableOnSubscribeExecuteAsBlockingTest method shouldCallOnErrorIfExceptionOccurred.
@SuppressWarnings({ "ThrowableInstanceNeverThrown", "ResourceType" })
@Test
public void shouldCallOnErrorIfExceptionOccurred() {
final PreparedCompletableOperation preparedOperation = mock(PreparedCompletableOperation.class);
StorIOException expectedException = new StorIOException("test exception");
when(preparedOperation.executeAsBlocking()).thenThrow(expectedException);
TestObserver testObserver = new TestObserver();
Completable completable = Completable.create(new CompletableOnSubscribeExecuteAsBlocking(preparedOperation));
verifyZeroInteractions(preparedOperation);
completable.subscribe(testObserver);
testObserver.assertError(expectedException);
testObserver.assertNotComplete();
verify(preparedOperation).executeAsBlocking();
verify(preparedOperation, never()).asRxFlowable(any(BackpressureStrategy.class));
verify(preparedOperation, never()).asRxSingle();
verify(preparedOperation, never()).asRxCompletable();
}
Aggregations