use of org.mockito.InOrder in project RxJava by ReactiveX.
the class FlowableFirstTest method testFirstOrDefaultWithPredicateAndOneElement.
@Test
public void testFirstOrDefaultWithPredicateAndOneElement() {
Single<Integer> observable = Flowable.just(1, 2).filter(new Predicate<Integer>() {
@Override
public boolean test(Integer t1) {
return t1 % 2 == 0;
}
}).first(4);
observable.subscribe(wo);
InOrder inOrder = inOrder(wo);
inOrder.verify(wo, times(1)).onSuccess(2);
inOrder.verifyNoMoreInteractions();
}
use of org.mockito.InOrder in project RxJava by ReactiveX.
the class FlowableFirstTest method testFirstWithPredicateFlowable.
@Test
public void testFirstWithPredicateFlowable() {
Flowable<Integer> observable = Flowable.just(1, 2, 3, 4, 5, 6).filter(new Predicate<Integer>() {
@Override
public boolean test(Integer t1) {
return t1 % 2 == 0;
}
}).firstElement().toFlowable();
Subscriber<Integer> observer = TestHelper.mockSubscriber();
observable.subscribe(observer);
InOrder inOrder = inOrder(observer);
inOrder.verify(observer, times(1)).onNext(2);
inOrder.verify(observer, times(1)).onComplete();
inOrder.verifyNoMoreInteractions();
}
use of org.mockito.InOrder in project RxJava by ReactiveX.
the class FlowableFirstTest method testFirstOrDefaultWithOneElementFlowable.
@Test
public void testFirstOrDefaultWithOneElementFlowable() {
Flowable<Integer> observable = Flowable.just(1).first(2).toFlowable();
Subscriber<Integer> observer = TestHelper.mockSubscriber();
observable.subscribe(observer);
InOrder inOrder = inOrder(observer);
inOrder.verify(observer, times(1)).onNext(1);
inOrder.verify(observer, times(1)).onComplete();
inOrder.verifyNoMoreInteractions();
}
use of org.mockito.InOrder in project RxJava by ReactiveX.
the class FlowableFirstTest method testFirstOrDefaultWithPredicate.
@Test
public void testFirstOrDefaultWithPredicate() {
Single<Integer> observable = Flowable.just(1, 2, 3, 4, 5, 6).filter(new Predicate<Integer>() {
@Override
public boolean test(Integer t1) {
return t1 % 2 == 0;
}
}).first(8);
observable.subscribe(wo);
InOrder inOrder = inOrder(wo);
inOrder.verify(wo, times(1)).onSuccess(2);
inOrder.verifyNoMoreInteractions();
}
use of org.mockito.InOrder in project RxJava by ReactiveX.
the class FlowableFirstTest method testFirstWithOneElementFlowable.
@Test
public void testFirstWithOneElementFlowable() {
Flowable<Integer> observable = Flowable.just(1).firstElement().toFlowable();
Subscriber<Integer> observer = TestHelper.mockSubscriber();
observable.subscribe(observer);
InOrder inOrder = inOrder(observer);
inOrder.verify(observer, times(1)).onNext(1);
inOrder.verify(observer, times(1)).onComplete();
inOrder.verifyNoMoreInteractions();
}
Aggregations