use of org.mockito.InOrder in project RxJava by ReactiveX.
the class FlowableDistinctUntilChangedTest method testDistinctUntilChangedOfNormalSource.
@Test
public void testDistinctUntilChangedOfNormalSource() {
Flowable<String> src = Flowable.just("a", "b", "c", "c", "c", "b", "b", "a", "e");
src.distinctUntilChanged().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("b");
inOrder.verify(w, times(1)).onNext("a");
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 FlowableDistinctUntilChangedTest method testDistinctUntilChangedOfNormalSourceWithKeySelector.
@Test
public void testDistinctUntilChangedOfNormalSourceWithKeySelector() {
Flowable<String> src = Flowable.just("a", "b", "c", "C", "c", "B", "b", "a", "e");
src.distinctUntilChanged(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("B");
inOrder.verify(w, times(1)).onNext("a");
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 FlowableLastTest method testLastWithOneElement.
@Test
public void testLastWithOneElement() {
Maybe<Integer> observable = Flowable.just(1).lastElement();
MaybeObserver<Integer> observer = TestHelper.mockMaybeObserver();
observable.subscribe(observer);
InOrder inOrder = inOrder(observer);
inOrder.verify(observer, times(1)).onSuccess(1);
// inOrder.verify(observer, times(1)).onComplete();
inOrder.verifyNoMoreInteractions();
}
use of org.mockito.InOrder in project RxJava by ReactiveX.
the class FlowableObserveOnTest method testDelayedErrorDeliveryWhenSafeSubscriberUnsubscribes.
@Test
public void testDelayedErrorDeliveryWhenSafeSubscriberUnsubscribes() {
TestScheduler testScheduler = new TestScheduler();
Flowable<Integer> source = Flowable.concat(Flowable.<Integer>error(new TestException()), Flowable.just(1));
@SuppressWarnings("unchecked") DefaultSubscriber<Integer> o = mock(DefaultSubscriber.class);
InOrder inOrder = inOrder(o);
source.observeOn(testScheduler).subscribe(o);
inOrder.verify(o, never()).onError(any(TestException.class));
testScheduler.advanceTimeBy(1, TimeUnit.SECONDS);
inOrder.verify(o).onError(any(TestException.class));
inOrder.verify(o, never()).onNext(anyInt());
inOrder.verify(o, never()).onComplete();
}
use of org.mockito.InOrder in project RxJava by ReactiveX.
the class FlowableObserveOnTest method testOrdering.
@Test
public void testOrdering() throws InterruptedException {
// Flowable<String> obs = Flowable.just("one", null, "two", "three", "four");
// FIXME null values not allowed
Flowable<String> obs = Flowable.just("one", "null", "two", "three", "four");
Subscriber<String> observer = TestHelper.mockSubscriber();
InOrder inOrder = inOrder(observer);
TestSubscriber<String> ts = new TestSubscriber<String>(observer);
obs.observeOn(Schedulers.computation()).subscribe(ts);
ts.awaitTerminalEvent(1000, TimeUnit.MILLISECONDS);
if (ts.errors().size() > 0) {
for (Throwable t : ts.errors()) {
t.printStackTrace();
}
fail("failed with exception");
}
inOrder.verify(observer, times(1)).onNext("one");
inOrder.verify(observer, times(1)).onNext("null");
inOrder.verify(observer, times(1)).onNext("two");
inOrder.verify(observer, times(1)).onNext("three");
inOrder.verify(observer, times(1)).onNext("four");
inOrder.verify(observer, times(1)).onComplete();
inOrder.verifyNoMoreInteractions();
}
Aggregations