@Test public void testErrorCatchingRightType() { FutureWithTrigger<Object> futureWithTrigger = new FutureWithTrigger<>(); DummyExceptions.DummyException1 exception = new DummyExceptions.DummyException1(); AtomicReference<DummyExceptions.DummyException1> exceptionReference1 = new AtomicReference<>(); AtomicReference<DummyExceptions.DummyException2> exceptionReference2 = new AtomicReference<>(); Object test = new Object(); Triggerer.triggerValue(test, futureWithTrigger); try { futureWithTrigger.getFuture().consume(v -> { throw exception; }).trap(DummyExceptions.DummyException2.class, e -> { exceptionReference2.set(e); throw e; }).trap(DummyExceptions.DummyException1.class, e -> { exceptionReference1.set(e); throw e; }).await(); fail("Exception should have been thrown"); } catch (Exception catchedException) { assertEquals(exception, exceptionReference1.get()); assertNull(exceptionReference2.get()); assertEquals(exception, catchedException); } }
public Future<T> getFuture(){ return this.future; }
FutureWithTrigger { public Future<T> getFuture(){ return this.future; } }
FutureWithTrigger { public Future<T> getFuture(){ return this.future; } FutureWithTrigger(); }
FutureWithTrigger { public Future<T> getFuture(){ return this.future; } FutureWithTrigger(); Callback<T> getTrigger(); Future<T> getFuture(); }
FutureWithTrigger { public Future<T> getFuture(){ return this.future; } FutureWithTrigger(); Callback<T> getTrigger(); Future<T> getFuture();  }