@Test public void testErrorRecoveringFuture() { FutureWithTrigger<Integer> futureWithTrigger = new FutureWithTrigger<>(); RuntimeException exception = new RuntimeException(); AtomicReference<RuntimeException> exceptionReference = new AtomicReference<>(); Triggerer.triggerErrorAsync(10, exception, futureWithTrigger); try { int value = futureWithTrigger.getFuture().trapFuture(RuntimeException.class, e -> { exceptionReference.set(e); return Futures.withValue(1); }).await(); assertEquals(1, value); assertEquals(exception, exceptionReference.get()); } catch (Exception catchedException) { fail("No error should have been thrown"); } }
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();  }