@Test public void testNoErrors() { TestSubscriber<Integer> ts = new TestSubscriber<Integer>(); ts.onError(new TestException()); try { ts.assertNoErrors(); } catch (AssertionError ex) { // expected return; } fail("Error present but no assertion error!"); }
@Test public void testMultipleErrors() { TestSubscriber<Integer> ts = new TestSubscriber<Integer>(); ts.onError(new TestException()); ts.onError(new TestException()); try { ts.assertNoErrors(); } catch (AssertionError ex) { if (!(ex.getCause() instanceof CompositeException)) { fail("Multiple Error present but the reported error doesn't have a composite cause!"); } // expected return; } fail("Multiple Error present but no assertion error!"); }