use of org.mockito.InOrder in project RxJava by ReactiveX.
the class FlowableLastTest method testLastWithPredicate.
@Test
public void testLastWithPredicate() {
Maybe<Integer> observable = Flowable.just(1, 2, 3, 4, 5, 6).filter(new Predicate<Integer>() {
@Override
public boolean test(Integer t1) {
return t1 % 2 == 0;
}
}).lastElement();
MaybeObserver<Integer> observer = TestHelper.mockMaybeObserver();
observable.subscribe(observer);
InOrder inOrder = inOrder(observer);
inOrder.verify(observer, times(1)).onSuccess(6);
// inOrder.verify(observer, times(1)).onComplete();
inOrder.verifyNoMoreInteractions();
}
use of org.mockito.InOrder in project RxJava by ReactiveX.
the class FlowableLastTest method testLast.
@Test
public void testLast() {
Maybe<Integer> observable = Flowable.just(1, 2, 3).lastElement();
MaybeObserver<Integer> observer = TestHelper.mockMaybeObserver();
observable.subscribe(observer);
InOrder inOrder = inOrder(observer);
inOrder.verify(observer, times(1)).onSuccess(3);
// inOrder.verify(observer, times(1)).onComplete();
inOrder.verifyNoMoreInteractions();
}
use of org.mockito.InOrder in project RxJava by ReactiveX.
the class FlowableLastTest method testLastOrDefaultWithOneElement.
@Test
public void testLastOrDefaultWithOneElement() {
Single<Integer> observable = Flowable.just(1).last(2);
SingleObserver<Integer> observer = TestHelper.mockSingleObserver();
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 FlowableLastTest method testLastWithPredicateAndEmpty.
@Test
public void testLastWithPredicateAndEmpty() {
Maybe<Integer> observable = Flowable.just(1).filter(new Predicate<Integer>() {
@Override
public boolean test(Integer t1) {
return t1 % 2 == 0;
}
}).lastElement();
MaybeObserver<Integer> observer = TestHelper.mockMaybeObserver();
observable.subscribe(observer);
InOrder inOrder = inOrder(observer);
inOrder.verify(observer).onComplete();
inOrder.verify(observer, never()).onError(any(Throwable.class));
inOrder.verifyNoMoreInteractions();
}
use of org.mockito.InOrder in project RxJava by ReactiveX.
the class FlowableRefCountTest method testAlreadyUnsubscribedInterleavesWithClient.
@Test
public void testAlreadyUnsubscribedInterleavesWithClient() {
ReplayProcessor<Integer> source = ReplayProcessor.create();
Subscriber<Integer> done = CancelledSubscriber.INSTANCE;
Subscriber<Integer> o = TestHelper.mockSubscriber();
InOrder inOrder = inOrder(o);
Flowable<Integer> result = source.publish().refCount();
result.subscribe(o);
source.onNext(1);
result.subscribe(done);
source.onNext(2);
source.onComplete();
inOrder.verify(o).onNext(1);
inOrder.verify(o).onNext(2);
inOrder.verify(o).onComplete();
verify(o, never()).onError(any(Throwable.class));
}
Aggregations