use of org.mockito.InOrder in project RxJava by ReactiveX.
the class FlowableFirstTest method testFirstOrDefaultWithEmpty.
@Test
public void testFirstOrDefaultWithEmpty() {
Single<Integer> observable = Flowable.<Integer>empty().first(1);
observable.subscribe(wo);
InOrder inOrder = inOrder(wo);
inOrder.verify(wo, times(1)).onSuccess(1);
inOrder.verifyNoMoreInteractions();
}
use of org.mockito.InOrder in project RxJava by ReactiveX.
the class FlowableFirstTest method testFirst.
@Test
public void testFirst() {
Maybe<Integer> observable = Flowable.just(1, 2, 3).firstElement();
observable.subscribe(wm);
InOrder inOrder = inOrder(wm);
inOrder.verify(wm, times(1)).onSuccess(1);
inOrder.verifyNoMoreInteractions();
}
use of org.mockito.InOrder in project RxJava by ReactiveX.
the class FlowableFirstTest method testFirstWithPredicateAndOneElement.
@Test
public void testFirstWithPredicateAndOneElement() {
Maybe<Integer> observable = Flowable.just(1, 2).filter(new Predicate<Integer>() {
@Override
public boolean test(Integer t1) {
return t1 % 2 == 0;
}
}).firstElement();
observable.subscribe(wm);
InOrder inOrder = inOrder(wm);
inOrder.verify(wm, times(1)).onSuccess(2);
inOrder.verifyNoMoreInteractions();
}
use of org.mockito.InOrder in project RxJava by ReactiveX.
the class FlowableFirstTest method testFirstOrDefault.
@Test
public void testFirstOrDefault() {
Single<Integer> observable = Flowable.just(1, 2, 3).first(4);
observable.subscribe(wo);
InOrder inOrder = inOrder(wo);
inOrder.verify(wo, times(1)).onSuccess(1);
inOrder.verifyNoMoreInteractions();
}
use of org.mockito.InOrder in project RxJava by ReactiveX.
the class FlowableFirstTest method testFirstWithEmptyFlowable.
@Test
public void testFirstWithEmptyFlowable() {
Flowable<Integer> observable = Flowable.<Integer>empty().firstElement().toFlowable();
Subscriber<Integer> observer = TestHelper.mockSubscriber();
observable.subscribe(observer);
InOrder inOrder = inOrder(observer);
inOrder.verify(observer).onComplete();
inOrder.verify(observer, never()).onError(any(Throwable.class));
inOrder.verifyNoMoreInteractions();
}
Aggregations