@Test public void teeWithExecutorCreateFail() { try { InvocationTee.teeWithExecutor(null, Runnable.class); fail("Exception should have thrown"); } catch (IllegalArgumentException e) { // expected } try { InvocationTee.teeWithExecutor(SameThreadSubmitterExecutor.instance(), null); fail("Exception should have thrown"); } catch (IllegalArgumentException e) { // expected } }
@Test public void invokeWithExecutorTest() { TestRunnable tr = new TestRunnable(); Runnable r = InvocationTee.teeWithExecutor(SameThreadSubmitterExecutor.instance(), Runnable.class, null, tr); r.run(); // should run just like the normal version assertTrue(tr.ranOnce()); } }