@Test public void testSingleOrDefaultWithTooManyElements() { Observable<Integer> observable = Observable.from(1, 2).singleOrDefault( 3); @SuppressWarnings("unchecked") Observer<Integer> observer = (Observer<Integer>) mock(Observer.class); observable.subscribe(observer); InOrder inOrder = inOrder(observer); inOrder.verify(observer, times(1)).onError( isA(IllegalArgumentException.class)); inOrder.verifyNoMoreInteractions(); }
public static <T> OnSubscribeFunc<T> singleOrDefault( final Observable<? extends T> source, final T defaultValue) { return single(source, true, defaultValue); }
OperationSingle { public static <T> OnSubscribeFunc<T> singleOrDefault( final Observable<? extends T> source, final T defaultValue) { return single(source, true, defaultValue); } }
OperationSingle { public static <T> OnSubscribeFunc<T> singleOrDefault( final Observable<? extends T> source, final T defaultValue) { return single(source, true, defaultValue); }  }
OperationSingle { public static <T> OnSubscribeFunc<T> singleOrDefault( final Observable<? extends T> source, final T defaultValue) { return single(source, true, defaultValue); }  static OnSubscribeFunc<T> single(
            final Observable<? extends T> source); static OnSubscribeFunc<T> singleOrDefault(
            final Observable<? extends T> source, final T defaultValue); }
OperationSingle { public static <T> OnSubscribeFunc<T> singleOrDefault( final Observable<? extends T> source, final T defaultValue) { return single(source, true, defaultValue); }  static OnSubscribeFunc<T> single(
            final Observable<? extends T> source); static OnSubscribeFunc<T> singleOrDefault(
            final Observable<? extends T> source, final T defaultValue);  }