use of org.mockito.InOrder in project RxJava by ReactiveX.
the class FlowableDelayTest method testDelayWithFlowableSubscriptionNormal.
@Test
public void testDelayWithFlowableSubscriptionNormal() {
PublishProcessor<Integer> source = PublishProcessor.create();
final PublishProcessor<Integer> delay = PublishProcessor.create();
Function<Integer, Flowable<Integer>> delayFunc = new Function<Integer, Flowable<Integer>>() {
@Override
public Flowable<Integer> apply(Integer t1) {
return delay;
}
};
Subscriber<Object> o = TestHelper.mockSubscriber();
InOrder inOrder = inOrder(o);
source.delay(delay, delayFunc).subscribe(o);
source.onNext(1);
delay.onNext(1);
source.onNext(2);
delay.onNext(2);
inOrder.verify(o).onNext(2);
inOrder.verifyNoMoreInteractions();
verify(o, never()).onError(any(Throwable.class));
verify(o, never()).onComplete();
}
use of org.mockito.InOrder in project RxJava by ReactiveX.
the class FlowableDelayTest method testDelayWithMultipleSubscriptions.
@Test
public void testDelayWithMultipleSubscriptions() {
Flowable<Long> source = Flowable.interval(1L, TimeUnit.SECONDS, scheduler).take(3);
Flowable<Long> delayed = source.delay(500L, TimeUnit.MILLISECONDS, scheduler);
delayed.subscribe(observer);
delayed.subscribe(observer2);
InOrder inOrder = inOrder(observer);
InOrder inOrder2 = inOrder(observer2);
scheduler.advanceTimeTo(1499L, TimeUnit.MILLISECONDS);
verify(observer, never()).onNext(anyLong());
verify(observer2, never()).onNext(anyLong());
scheduler.advanceTimeTo(1500L, TimeUnit.MILLISECONDS);
inOrder.verify(observer, times(1)).onNext(0L);
inOrder2.verify(observer2, times(1)).onNext(0L);
scheduler.advanceTimeTo(2499L, TimeUnit.MILLISECONDS);
inOrder.verify(observer, never()).onNext(anyLong());
inOrder2.verify(observer2, never()).onNext(anyLong());
scheduler.advanceTimeTo(2500L, TimeUnit.MILLISECONDS);
inOrder.verify(observer, times(1)).onNext(1L);
inOrder2.verify(observer2, times(1)).onNext(1L);
verify(observer, never()).onComplete();
verify(observer2, never()).onComplete();
scheduler.advanceTimeTo(3500L, TimeUnit.MILLISECONDS);
inOrder.verify(observer, times(1)).onNext(2L);
inOrder2.verify(observer2, times(1)).onNext(2L);
inOrder.verify(observer, never()).onNext(anyLong());
inOrder2.verify(observer2, never()).onNext(anyLong());
inOrder.verify(observer, times(1)).onComplete();
inOrder2.verify(observer2, times(1)).onComplete();
verify(observer, never()).onError(any(Throwable.class));
verify(observer2, never()).onError(any(Throwable.class));
}
use of org.mockito.InOrder in project RxJava by ReactiveX.
the class FlowableDelayTest method testDelayWithFlowableEmptyDelayer.
@Test
public void testDelayWithFlowableEmptyDelayer() {
PublishProcessor<Integer> source = PublishProcessor.create();
Function<Integer, Flowable<Integer>> delayFunc = new Function<Integer, Flowable<Integer>>() {
@Override
public Flowable<Integer> apply(Integer t1) {
return Flowable.empty();
}
};
Subscriber<Object> o = TestHelper.mockSubscriber();
InOrder inOrder = inOrder(o);
source.delay(delayFunc).subscribe(o);
source.onNext(1);
source.onComplete();
inOrder.verify(o).onNext(1);
inOrder.verify(o).onComplete();
inOrder.verifyNoMoreInteractions();
verify(o, never()).onError(any(Throwable.class));
}
use of org.mockito.InOrder in project RxJava by ReactiveX.
the class FlowableDistinctTest method testDistinctOfNormalSourceWithKeySelector.
@Test
public void testDistinctOfNormalSourceWithKeySelector() {
Flowable<String> src = Flowable.just("a", "B", "c", "C", "c", "B", "b", "a", "E");
src.distinct(TO_UPPER_WITH_EXCEPTION).subscribe(w);
InOrder inOrder = inOrder(w);
inOrder.verify(w, times(1)).onNext("a");
inOrder.verify(w, times(1)).onNext("B");
inOrder.verify(w, times(1)).onNext("c");
inOrder.verify(w, times(1)).onNext("E");
inOrder.verify(w, times(1)).onComplete();
inOrder.verify(w, never()).onNext(anyString());
verify(w, never()).onError(any(Throwable.class));
}
use of org.mockito.InOrder in project RxJava by ReactiveX.
the class FlowableDistinctTest method testDistinctOfNormalSource.
@Test
public void testDistinctOfNormalSource() {
Flowable<String> src = Flowable.just("a", "b", "c", "c", "c", "b", "b", "a", "e");
src.distinct().subscribe(w);
InOrder inOrder = inOrder(w);
inOrder.verify(w, times(1)).onNext("a");
inOrder.verify(w, times(1)).onNext("b");
inOrder.verify(w, times(1)).onNext("c");
inOrder.verify(w, times(1)).onNext("e");
inOrder.verify(w, times(1)).onComplete();
inOrder.verify(w, never()).onNext(anyString());
verify(w, never()).onError(any(Throwable.class));
}
Aggregations