Java Code Examples for io.reactivex.Flowable#never()

The following examples show how to use io.reactivex.Flowable#never() . 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: FromRSPublisherTCK.java    From smallrye-reactive-streams-operators with Apache License 2.0 5 votes vote down vote up
@Test
public void testWithNever() throws InterruptedException {
    Publisher<String> never = Flowable.never();
    T instance = converter().fromPublisher(never);
    CountDownLatch latch = new CountDownLatch(1);
    Future<?> future = Executors.newSingleThreadExecutor().submit(() -> {
        getOne(instance);
        latch.countDown();
    });
    boolean terminated = latch.await(10, TimeUnit.MILLISECONDS);
    future.cancel(true);
    assertThat(terminated).isFalse();
}
 
Example 2
Source File: FlowableMergeInterleavedTest.java    From rxjava2-extras with Apache License 2.0 5 votes vote down vote up
@Test
public void testInterleaveInfiniteStreamWithNever() {
    Flowable<Integer> a = Flowable.just(1).repeat();
    Flowable<Integer> b = Flowable.never();
    Flowables.mergeInterleaved(Flowable.just(a, b), 2, 1, true) //
            .test(3) //
            .assertValues(1, 1, 1) //
            .assertNotTerminated();
}
 
Example 3
Source File: FlowableMergeInterleavedTest.java    From rxjava2-extras with Apache License 2.0 5 votes vote down vote up
@Test
public void testInterleaveInfiniteStreamWithNeverReversed() {
    Flowable<Integer> a = Flowable.never();
    Flowable<Integer> b = Flowable.just(1).repeat();
    Flowables.mergeInterleaved(Flowable.just(a, b), 2, 1, true) //
            .test(3) //
            .assertValues(1, 1, 1) //
            .assertNotTerminated();
}