use of io.reactivex.functions.Predicate in project RxJava by ReactiveX.
the class FlowableFirstTest method testFirstOrDefaultWithPredicateAndEmpty.
@Test
public void testFirstOrDefaultWithPredicateAndEmpty() {
Single<Integer> observable = Flowable.just(1).filter(new Predicate<Integer>() {
@Override
public boolean test(Integer t1) {
return t1 % 2 == 0;
}
}).first(2);
observable.subscribe(wo);
InOrder inOrder = inOrder(wo);
inOrder.verify(wo, times(1)).onSuccess(2);
inOrder.verifyNoMoreInteractions();
}
use of io.reactivex.functions.Predicate 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 io.reactivex.functions.Predicate 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 io.reactivex.functions.Predicate 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 io.reactivex.functions.Predicate in project RxJava by ReactiveX.
the class ObservableFirstTest method testFirstWithPredicate.
@Test
public void testFirstWithPredicate() {
Maybe<Integer> o = Observable.just(1, 2, 3, 4, 5, 6).filter(new Predicate<Integer>() {
@Override
public boolean test(Integer t1) {
return t1 % 2 == 0;
}
}).firstElement();
o.subscribe(wm);
InOrder inOrder = inOrder(wm);
inOrder.verify(wm, times(1)).onSuccess(2);
inOrder.verifyNoMoreInteractions();
}