@Test (expected = IllegalArgumentException.class) public void teeWithExceptionThrowingCreateFail() { InvocationTee.teeWithExceptionThrowing(null); }
@Test public void invokeWithExceptionThrowingTest() { TestRunnable tr = new TestRunnable(); Runnable r = InvocationTee.teeWithExceptionThrowing(Runnable.class, null, tr); r.run(); // should run just like the normal version assertTrue(tr.ranOnce()); }
@Test public void invokeWithExceptionThrowingListenerExceptionTest() { RuntimeException thrown = new SuppressedStackRuntimeException(); TestRunnable tr = new TestRuntimeFailureRunnable(thrown); Runnable r = InvocationTee.teeWithExceptionThrowing(Runnable.class, null, tr); try { r.run(); fail("Exception should have thrown"); } catch (RuntimeException e) { assertTrue(thrown == e); } }