@Test public void testTakeWhileProtectsPredicateCall() { TestObservable source = new TestObservable(mock(Subscription.class), "one"); final RuntimeException testException = new RuntimeException("test exception"); @SuppressWarnings("unchecked") Observer<String> observer = mock(Observer.class); Observable<String> take = Observable.create(takeWhile(Observable.create(source), new Func1<String, Boolean>() { @Override public Boolean call(String s) { throw testException; } })); take.subscribe(observer); try { source.t.join(); } catch (Throwable e) { e.printStackTrace(); fail(e.getMessage()); } verify(observer, never()).onNext(any(String.class)); verify(observer, times(1)).onError(testException); }
public static <T> OnSubscribeFunc<T> takeWhile(final Observable<? extends T> items, final Func1<? super T, Boolean> predicate) { return takeWhileWithIndex(items, OperationTakeWhile.<T> skipIndex(predicate)); }
OperationTakeWhile { public static <T> OnSubscribeFunc<T> takeWhile(final Observable<? extends T> items, final Func1<? super T, Boolean> predicate) { return takeWhileWithIndex(items, OperationTakeWhile.<T> skipIndex(predicate)); } }
OperationTakeWhile { public static <T> OnSubscribeFunc<T> takeWhile(final Observable<? extends T> items, final Func1<? super T, Boolean> predicate) { return takeWhileWithIndex(items, OperationTakeWhile.<T> skipIndex(predicate)); }  }
OperationTakeWhile { public static <T> OnSubscribeFunc<T> takeWhile(final Observable<? extends T> items, final Func1<? super T, Boolean> predicate) { return takeWhileWithIndex(items, OperationTakeWhile.<T> skipIndex(predicate)); }  static OnSubscribeFunc<T> takeWhile(final Observable<? extends T> items, final Func1<? super T, Boolean> predicate); static OnSubscribeFunc<T> takeWhileWithIndex(final Observable<? extends T> items, final Func2<? super T, ? super Integer, Boolean> predicate); }
OperationTakeWhile { public static <T> OnSubscribeFunc<T> takeWhile(final Observable<? extends T> items, final Func1<? super T, Boolean> predicate) { return takeWhileWithIndex(items, OperationTakeWhile.<T> skipIndex(predicate)); }  static OnSubscribeFunc<T> takeWhile(final Observable<? extends T> items, final Func1<? super T, Boolean> predicate); static OnSubscribeFunc<T> takeWhileWithIndex(final Observable<? extends T> items, final Func2<? super T, ? super Integer, Boolean> predicate);  }