@Test public void testErrorCatchingFuture() { FutureWithTrigger<Object> futureWithTrigger = new FutureWithTrigger<>(); RuntimeException exception = new RuntimeException(); AtomicReference<RuntimeException> exceptionReference = new AtomicReference<>(); Triggerer.triggerValue(new Object(), futureWithTrigger); try { futureWithTrigger.getFuture().consume(v -> { throw exception; }).trapFuture(RuntimeException.class, e -> { exceptionReference.set(e); throw e; }).await(); fail("Exception should have been thrown"); } catch (Exception catchedException) { assertEquals(exception, exceptionReference.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();  }