@Test public void andNErrorNRange() { for (int n = 10; n < 100; n++) { PatternN p = JoinObservable.from(some) .and(some) .and(some) .and(some) .and(some) .and(some) .and(some) .and(some) .and(some) .and(some); for (int j = 0; j < n - 10; j++) { p = p.and(some); } p = p.and(error); verifyError(JoinObservable.when(p.then(add))); } }
@Test public void andN() { int s = 10; for (int n = s; n < 100; n++) { System.out.println("AndN(" + n + ")"); PatternN p = JoinObservable.from(some) .and(some) .and(some) .and(some) .and(some) .and(some) .and(some) .and(some) .and(some) .and(some); for (int j = 0; j < n - s; j++) { p = p.and(some); } verifyAnd(JoinObservable.when(p.then(add)), n); } }
@Test public void thenNArgumentNull() { for (int n = 10; n < 100; n++) { PatternN p = JoinObservable.from(some).and(some) .and(some).and(some) .and(some).and(some) .and(some).and(some) .and(some).and(some); try { for (int j = 0; j < n - 10; j++) { p = p.and(some); } p.then(null); fail("Failed to throw exception with pattern length " + n); } catch (NullPointerException ex) { // expected, continue } } }
@Test public void thenNThrows() { for (int n = 10; n < 100; n++) { PatternN p = JoinObservable.from(some) .and(some) .and(some) .and(some) .and(some) .and(some) .and(some) .and(some) .and(some) .and(some); for (int j = 0; j < n - 10; j++) { p = p.and(some); } verifyError(JoinObservable.when(p.then(throwFunc))); } }