Java Code Examples for io.reactivex.rxjava3.subscribers.TestSubscriber#assertComplete()
The following examples show how to use
io.reactivex.rxjava3.subscribers.TestSubscriber#assertComplete() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReplayingShareFlowableTest.java From RxReplayingShare with Apache License 2.0 | 6 votes |
@Test public void completeClearsCacheAndResubscribes() { List<String> start = new ArrayList<>(); start.add("initA"); PublishProcessor<String> upstream = PublishProcessor.create(); Flowable<String> replayed = upstream.startWithIterable(start).compose(ReplayingShare.<String>instance()); TestSubscriber<String> subscriber1 = new TestSubscriber<>(); replayed.subscribe(subscriber1); subscriber1.assertValues("initA"); TestSubscriber<String> observer2 = new TestSubscriber<>(); replayed.subscribe(observer2); subscriber1.assertValues("initA"); upstream.onComplete(); subscriber1.assertComplete(); observer2.assertComplete(); start.set(0, "initB"); TestSubscriber<String> observer3 = new TestSubscriber<>(); replayed.subscribe(observer3); observer3.assertValues("initB"); }
Example 2
Source File: ReplayingShareFlowableTest.java From RxReplayingShare with Apache License 2.0 | 6 votes |
@Test public void completeClearsCacheAndResubscribesStartingWithDefault() { List<String> start = new ArrayList<>(); start.add("initA"); PublishProcessor<String> upstream = PublishProcessor.create(); Flowable<String> replayed = upstream.startWithIterable(start).compose(ReplayingShare.createWithDefault("default")); TestSubscriber<String> subscriber1 = new TestSubscriber<>(); replayed.subscribe(subscriber1); subscriber1.assertValues("default", "initA"); TestSubscriber<String> observer2 = new TestSubscriber<>(); replayed.subscribe(observer2); subscriber1.assertValues("default", "initA"); upstream.onComplete(); subscriber1.assertComplete(); observer2.assertComplete(); start.set(0, "initB"); TestSubscriber<String> observer3 = new TestSubscriber<>(); replayed.subscribe(observer3); observer3.assertValues("default", "initB"); }
Example 3
Source File: TimeLimiterTransformerPublisherTest.java From resilience4j with Apache License 2.0 | 5 votes |
@Test public void doNotTimeoutEmpty() { given(timeLimiter.getTimeLimiterConfig()) .willReturn(toConfig(Duration.ofMinutes(1))); TestSubscriber<Object> subscriber = Flowable.empty() .compose(TimeLimiterTransformer.of(timeLimiter)) .test(); subscriber.assertComplete(); then(timeLimiter).should() .onSuccess(); }
Example 4
Source File: UntilCorrespondingEventTransformerFlowableTest.java From RxLifecycle with Apache License 2.0 | 5 votes |
@Test public void openAndCloseEvent() { TestSubscriber<String> testSubscriber = stream .compose(RxLifecycle.<String, String>bind(lifecycle, CORRESPONDING_EVENTS)) .test(); lifecycle.onNext("create"); stream.onNext("1"); lifecycle.onNext("destroy"); stream.onNext("2"); testSubscriber.assertValues("1"); testSubscriber.assertComplete(); }
Example 5
Source File: UntilLifecycleTransformerFlowableTest.java From RxLifecycle with Apache License 2.0 | 5 votes |
@Test public void oneEvent() { TestSubscriber<String> testSubscriber = stream .compose(RxLifecycle.<String, String>bind(lifecycle)) .test(); stream.onNext("1"); lifecycle.onNext("stop"); stream.onNext("2"); testSubscriber.assertValues("1"); testSubscriber.assertComplete(); }
Example 6
Source File: UntilEventTransformerFlowableTest.java From RxLifecycle with Apache License 2.0 | 5 votes |
@Test public void twoEvents() { TestSubscriber<String> testSubscriber = stream .compose(RxLifecycle.<String, String>bindUntilEvent(lifecycle, "stop")) .test(); stream.onNext("1"); lifecycle.onNext("keep going"); stream.onNext("2"); lifecycle.onNext("stop"); stream.onNext("3"); testSubscriber.assertValues("1", "2"); testSubscriber.assertComplete(); }