/** * Creates a pattern that matches when all three observable sequences have an available element. * * @param <T4> the value type of the extra Observable * @param other * Observable sequence to match with the two previous sequences. * @return Pattern object that matches when all observable sequences have an available element. */ public <T4> Pattern4<T1, T2, T3, T4> and(Observable<T4> other) { if (other == null) { throw new NullPointerException(); } return new Pattern4<T1, T2, T3, T4>(o1, o2, o3, other); }
Consumer<Throwable> onError = onErrorFrom(observer); final JoinObserver1<T1> jo1 = createObserver(externalSubscriptions, expression.o1(), onError); final JoinObserver1<T2> jo2 = createObserver(externalSubscriptions, expression.o2(), onError); final JoinObserver1<T3> jo3 = createObserver(externalSubscriptions, expression.o3(), onError); final JoinObserver1<T4> jo4 = createObserver(externalSubscriptions, expression.o4(), onError);
@Test(expected = NullPointerException.class) public void then5ArgumentNull() { JoinObservable.from(some).and(some).and(some).and(some).and(some).then(null); }
@Test(expected = NullPointerException.class) public void then4ArgumentNull() { JoinObservable.from(some).and(some).and(some).and(some).then(null); }
@Test public void then4Throws() { verifyError(JoinObservable.when( JoinObservable .from(some) .and(some) .and(some) .and(some) .then(throwFunc))); }
Consumer<Throwable> onError = onErrorFrom(observer); final JoinObserver1<T1> jo1 = createObserver(externalSubscriptions, expression.o1(), onError); final JoinObserver1<T2> jo2 = createObserver(externalSubscriptions, expression.o2(), onError); final JoinObserver1<T3> jo3 = createObserver(externalSubscriptions, expression.o3(), onError); final JoinObserver1<T4> jo4 = createObserver(externalSubscriptions, expression.o4(), onError);
@Test(expected = NullPointerException.class) public void then6ArgumentNull() { JoinObservable.from(some).and(some).and(some).and(some).and(some).and(some).then(null); }
/** * Creates a pattern that matches when all three observable sequences have an available element. * * @param <T4> the value type of the extra Observable * @param other * Observable sequence to match with the two previous sequences. * @return Pattern object that matches when all observable sequences have an available element. */ public <T4> Pattern4<T1, T2, T3, T4> and(Observable<T4> other) { if (other == null) { throw new NullPointerException(); } return new Pattern4<T1, T2, T3, T4>(o1, o2, o3, other); }
@Test public void and4Error4() { verifyError(JoinObservable.when( JoinObservable.from(some) .and(some) .and(some) .and(error) .then(add))); }
@Test public void and5Error4() { verifyError(JoinObservable.when( JoinObservable.from(some) .and(some) .and(some) .and(error) .and(some) .then(add))); }
@Test public void and4() { verifyAnd(JoinObservable.when(JoinObservable.from(some) .and(some) .and(some) .and(some) .then(add)), 4); }
@Test public void then5Throws() { verifyError(JoinObservable.when( JoinObservable .from(some) .and(some) .and(some) .and(some) .and(some) .then(throwFunc))); }
@Test public void and4Error1() { verifyError(JoinObservable.when( JoinObservable.from(error) .and(some) .and(some) .and(some) .then(add))); }
@Test public void and5Error1() { verifyError(JoinObservable.when( JoinObservable.from(error) .and(some) .and(some) .and(some) .and(some) .then(add))); }
@Test public void and4Error3() { verifyError(JoinObservable.when( JoinObservable.from(some) .and(some) .and(error) .and(some) .then(add))); }
@Test public void and5Error2() { verifyError(JoinObservable.when( JoinObservable.from(some) .and(error) .and(some) .and(some) .and(some) .then(add))); }
@Test public void and4Error2() { verifyError(JoinObservable.when( JoinObservable.from(some) .and(error) .and(some) .and(some) .then(add))); }
@Test public void and5() { verifyAnd(JoinObservable.when(JoinObservable.from(some) .and(some) .and(some) .and(some) .and(some) .then(add)), 5); }
@Test public void and5Error3() { verifyError(JoinObservable.when( JoinObservable.from(some) .and(some) .and(error) .and(some) .and(some) .then(add))); }
@Test public void and5Error5() { verifyError(JoinObservable.when( JoinObservable.from(some) .and(some) .and(some) .and(some) .and(error) .then(add))); }