@Override public String toString() { return emitter.toString(); } }
@Override public String toString() { return val.toString(); }
@Override public String toString() { return String.format("TimedRunnable(time = %d, run = %s)", time, run.toString()); }
public Builder socket(Socket socket) throws IOException { SocketAddress remoteSocketAddress = socket.getRemoteSocketAddress(); String connectionName = remoteSocketAddress instanceof InetSocketAddress ? ((InetSocketAddress) remoteSocketAddress).getHostName() : remoteSocketAddress.toString(); return socket(socket, connectionName, Okio.buffer(Okio.source(socket)), Okio.buffer(Okio.sink(socket))); }
@Override public void subscribe(CompletableEmitter emitter) throws Exception { assertTrue(emitter.toString().contains(CompletableCreate.Emitter.class.getSimpleName())); } }).test().assertEmpty();
@Override public void subscribe(MaybeEmitter<Object> emitter) throws Exception { assertTrue(emitter.toString().contains(MaybeCreate.Emitter.class.getSimpleName())); } }).test().assertEmpty();
@Override public void subscribe(SingleEmitter<Object> emitter) throws Exception { assertTrue(emitter.toString().contains(SingleCreate.Emitter.class.getSimpleName())); } }).test().assertEmpty();
@Override public void subscribe(ObservableEmitter<Object> emitter) throws Exception { assertTrue(emitter.toString().contains(ObservableCreate.CreateEmitter.class.getSimpleName())); assertTrue(emitter.serialize().toString().contains(ObservableCreate.CreateEmitter.class.getSimpleName())); } }).test().assertEmpty();
@Test public void validateDisposable() { Disposable d1 = Disposables.empty(); assertFalse(EndConsumerHelper.validate(DisposableHelper.DISPOSED, d1, getClass())); assertTrue(d1.isDisposed()); assertTrue(errors.toString(), errors.isEmpty()); }
@Test public void validateSubscription() { BooleanSubscription bs1 = new BooleanSubscription(); assertFalse(EndConsumerHelper.validate(SubscriptionHelper.CANCELLED, bs1, getClass())); assertTrue(bs1.isCancelled()); assertTrue(errors.toString(), errors.isEmpty()); } }
@Test public void timerDelayZero() { List<Throwable> errors = TestHelper.trackPluginErrors(); try { for (int i = 0; i < 1000; i++) { Flowable.timer(0, TimeUnit.MILLISECONDS).blockingFirst(); } assertTrue(errors.toString(), errors.isEmpty()); } finally { RxJavaPlugins.reset(); } }
@Test public void timerDelayZero() { List<Throwable> errors = TestHelper.trackPluginErrors(); try { for (int i = 0; i < 1000; i++) { Observable.timer(0, TimeUnit.MILLISECONDS).blockingFirst(); } assertTrue(errors.toString(), errors.isEmpty()); } finally { RxJavaPlugins.reset(); } }
@Test public void errorConsumerEmpty() throws Exception { List<Throwable> errors = TestHelper.trackPluginErrors(); try { Functions.ERROR_CONSUMER.accept(new TestException()); TestHelper.assertUndeliverable(errors, 0, TestException.class); assertEquals(errors.toString(), 1, errors.size()); } finally { RxJavaPlugins.reset(); } } }
@Test public void doOnError() { final Object[] event = { null }; Single.error(new TestException()).doOnError(new Consumer<Throwable>() { @Override public void accept(Throwable e) throws Exception { event[0] = e; } }) .test(); assertTrue(event[0].toString(), event[0] instanceof TestException); }
@Test public void otherSignalsAndCompletes() { List<Throwable> errors = TestHelper.trackPluginErrors(); try { Single.just(1).takeUntil(Flowable.just(1).take(1)) .test() .assertFailure(CancellationException.class); assertTrue(errors.toString(), errors.isEmpty()); } finally { RxJavaPlugins.reset(); } }
@Test public void disposableNotification() { Object o = NotificationLite.disposable(Disposables.empty()); assertEquals("NotificationLite.Disposable[RunnableDisposable(disposed=false, EmptyRunnable)]", o.toString()); assertFalse(NotificationLite.isError(o)); assertFalse(NotificationLite.isComplete(o)); assertTrue(NotificationLite.isDisposable(o)); assertFalse(NotificationLite.isSubscription(o)); assertNotNull(NotificationLite.getDisposable(o)); }
@Test public void subscriptionNotification() { Object o = NotificationLite.subscription(new BooleanSubscription()); assertEquals("NotificationLite.Subscription[BooleanSubscription(cancelled=false)]", o.toString()); assertFalse(NotificationLite.isError(o)); assertFalse(NotificationLite.isComplete(o)); assertFalse(NotificationLite.isDisposable(o)); assertTrue(NotificationLite.isSubscription(o)); assertNotNull(NotificationLite.getSubscription(o)); }
@Test public void errorNotification() { Object o = NotificationLite.error(new TestException()); assertEquals("NotificationLite.Error[io.reactivex.exceptions.TestException]", o.toString()); assertTrue(NotificationLite.isError(o)); assertFalse(NotificationLite.isComplete(o)); assertFalse(NotificationLite.isDisposable(o)); assertFalse(NotificationLite.isSubscription(o)); assertTrue(NotificationLite.getError(o) instanceof TestException); }
@Test public void completeNotification() { Object o = NotificationLite.complete(); Object o2 = NotificationLite.complete(); assertSame(o, o2); assertFalse(NotificationLite.isError(o)); assertTrue(NotificationLite.isComplete(o)); assertFalse(NotificationLite.isDisposable(o)); assertFalse(NotificationLite.isSubscription(o)); assertEquals("NotificationLite.Complete", o.toString()); assertTrue(NotificationLite.isComplete(o)); }