@Test public void testCurrentStateMethodsEmpty() { ReplaySubject<Object> as = ReplaySubject.create(); assertFalse(as.hasThrowable()); assertFalse(as.hasComplete()); assertNull(as.getThrowable()); as.onComplete(); assertFalse(as.hasThrowable()); assertTrue(as.hasComplete()); assertNull(as.getThrowable()); }
@Test public void testCurrentStateMethodsError() { ReplaySubject<Object> as = ReplaySubject.create(); assertFalse(as.hasThrowable()); assertFalse(as.hasComplete()); assertNull(as.getThrowable()); as.onError(new TestException()); assertTrue(as.hasThrowable()); assertFalse(as.hasComplete()); assertTrue(as.getThrowable() instanceof TestException); }
@Test public void testCurrentStateMethodsNormal() { ReplaySubject<Object> as = ReplaySubject.create(); assertFalse(as.hasThrowable()); assertFalse(as.hasComplete()); assertNull(as.getThrowable()); as.onNext(1); assertFalse(as.hasThrowable()); assertFalse(as.hasComplete()); assertNull(as.getThrowable()); as.onComplete(); assertFalse(as.hasThrowable()); assertTrue(as.hasComplete()); assertNull(as.getThrowable()); }