Search in sources :

Example 1 with VoidBehaviors

use of com.amplifyframework.rx.RxAdapters.VoidBehaviors in project amplify-android by aws-amplify.

the class RxAdaptersTest method completableIsDisposable.

/**
 * The {@link Completable} returned by
 * {@link VoidBehaviors#toCompletable(VoidBehaviors.ActionEmitter)}
 * is cancelable.
 */
// No-op VoidResultEmitter body
@SuppressWarnings("checkstyle:WhitespaceAround")
@Test
public void completableIsDisposable() {
    Completable completable = VoidBehaviors.toCompletable(((onResult, onError) -> {
    }));
    TestObserver<?> observer = completable.test();
    observer.dispose();
    assertTrue(observer.isDisposed());
}
Also used : Single(io.reactivex.rxjava3.core.Single) SimpleCancelable(com.amplifyframework.testutils.SimpleCancelable) CancelableBehaviors(com.amplifyframework.rx.RxAdapters.CancelableBehaviors) VoidBehaviors(com.amplifyframework.rx.RxAdapters.VoidBehaviors) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) Completable(io.reactivex.rxjava3.core.Completable) Sleep(com.amplifyframework.testutils.Sleep) TestObserver(io.reactivex.rxjava3.observers.TestObserver) Cancelable(com.amplifyframework.core.async.Cancelable) Observable(io.reactivex.rxjava3.core.Observable) RandomString(com.amplifyframework.testutils.random.RandomString) NoOpCancelable(com.amplifyframework.core.async.NoOpCancelable) Disposable(io.reactivex.rxjava3.disposables.Disposable) UndeliverableException(io.reactivex.rxjava3.exceptions.UndeliverableException) Completable(io.reactivex.rxjava3.core.Completable) Test(org.junit.Test)

Aggregations

Cancelable (com.amplifyframework.core.async.Cancelable)1 NoOpCancelable (com.amplifyframework.core.async.NoOpCancelable)1 CancelableBehaviors (com.amplifyframework.rx.RxAdapters.CancelableBehaviors)1 VoidBehaviors (com.amplifyframework.rx.RxAdapters.VoidBehaviors)1 SimpleCancelable (com.amplifyframework.testutils.SimpleCancelable)1 Sleep (com.amplifyframework.testutils.Sleep)1 RandomString (com.amplifyframework.testutils.random.RandomString)1 Completable (io.reactivex.rxjava3.core.Completable)1 Observable (io.reactivex.rxjava3.core.Observable)1 Single (io.reactivex.rxjava3.core.Single)1 Disposable (io.reactivex.rxjava3.disposables.Disposable)1 UndeliverableException (io.reactivex.rxjava3.exceptions.UndeliverableException)1 TestObserver (io.reactivex.rxjava3.observers.TestObserver)1 Assert.assertTrue (org.junit.Assert.assertTrue)1 Test (org.junit.Test)1