@Override public SingleSource<Integer> apply(Integer v) throws Exception { if (v == 1) { return ms; } return Single.never(); } }).test();
@Override public SingleSource<B<T>> apply(Single<A<T, ?>> a) { return Single.never(); } };
@Override public SingleSource<Integer> apply(Integer v) throws Exception { if (v == 1) { return ms; } return Single.never(); } }).test();
@Override public SingleSource<Integer> apply(Integer v) throws Exception { if (v == 1) { return ms; } return Single.never(); } }).test();
@Override public SingleSource<Integer> apply(Integer v) throws Exception { if (v == 1) { return ms; } return Single.never(); } }).test();
@Override public SingleSource<Integer> apply(Integer v) throws Exception { if (v == 1) { return ms; } return Single.never(); } }).test();
@Override public Publisher<Object> apply(Flowable<Object> f) throws Exception { return f .switchMapSingle(Functions.justFunction(Single.never())); } }
@Override public Observable<Object> apply(Observable<Object> f) throws Exception { return f .switchMapSingle(Functions.justFunction(Single.never())); } }
@Override public Observable<Object> apply(Observable<Object> f) throws Exception { return f.concatMapSingleDelayError( Functions.justFunction(Single.never())); } }
@Test public void disposed() { TestHelper.checkDisposed(Observable.just(1).hide() .concatMapSingle(Functions.justFunction(Single.never())) ); }
@Test public void doOnSubscribe() { final int[] count = { 0 }; Single.never().doOnSubscribe(new Consumer<Disposable>() { @Override public void accept(Disposable d) throws Exception { count[0]++; } }).test(); assertEquals(1, count[0]); }
@Test public void source() { Single<Integer> c = Single.never(); assertSame(c, ((HasUpstreamSingleSource<?>)Maybe.fromSingle(c)).source()); }
@Test public void timeoutOther() throws Exception { Single.never() .timeout(100, TimeUnit.MILLISECONDS, Schedulers.io(), Single.just(1)) .test() .awaitDone(5, TimeUnit.SECONDS) .assertResult(1); }
@Test public void timeout() throws Exception { Future<?> f = Single.never().toFuture(); try { f.get(100, TimeUnit.MILLISECONDS); fail("Should have thrown"); } catch (TimeoutException expected) { assertEquals(timeoutMessage(100, TimeUnit.MILLISECONDS), expected.getMessage()); } }
@Test public void never() { Single.never() .test() .assertNoValues() .assertNoErrors() .assertNotComplete(); }
@Test public void mainTimedOut() { Single .never() .timeout(1, TimeUnit.NANOSECONDS) .test() .awaitDone(5, TimeUnit.SECONDS) .assertFailureAndMessage(TimeoutException.class, timeoutMessage(1, TimeUnit.NANOSECONDS)); } }
@Test public void otherErrors() { Single.never() .timeout(1, TimeUnit.MILLISECONDS, Single.error(new TestException())) .test() .awaitDone(5, TimeUnit.SECONDS) .assertFailure(TestException.class); }
@Test public void mainError() { Observable.error(new TestException()) .switchMapSingle(Functions.justFunction(Single.never())) .test() .assertFailure(TestException.class); }
@Test public void mainError() { Flowable.error(new TestException()) .switchMapSingle(Functions.justFunction(Single.never())) .test() .assertFailure(TestException.class); }
@Test(timeout = 10000) public void cancelNoConcurrentClean() { TestObserver<Integer> to = new TestObserver<Integer>(); ConcatMapSingleMainObserver<Integer, Integer> operator = new ConcatMapSingleMainObserver<Integer, Integer>( to, Functions.justFunction(Single.<Integer>never()), 16, ErrorMode.IMMEDIATE); operator.onSubscribe(Disposables.empty()); operator.queue.offer(1); operator.getAndIncrement(); to.cancel(); assertFalse(operator.queue.isEmpty()); operator.addAndGet(-2); operator.dispose(); assertTrue(operator.queue.isEmpty()); }