@Test
public void testErrorRecovering() {

    FutureWithTrigger<Integer> futureWithTrigger = new FutureWithTrigger<>();
    RuntimeException exception = new RuntimeException();
    AtomicReference<RuntimeException> exceptionReference = new AtomicReference<>();
    Triggerer.triggerErrorAsync(10, exception, futureWithTrigger);
    try {
        int value = futureWithTrigger.getFuture().trap(RuntimeException.class, e -> {
            exceptionReference.set(e);
            return 1;
        }).await();
        assertEquals(1, value);
        assertEquals(exception, exceptionReference.get());
    } catch (Exception catchedException) {
        fail("No error should have been thrown");
    }
}