@Test
public void testErrorThrowingAsync() {

    FutureWithTrigger<Object> futureWithTrigger = new FutureWithTrigger<>();
    RuntimeException exception = new RuntimeException();
    AtomicReference<RuntimeException> exceptionReference = new AtomicReference<>();
    Triggerer.triggerErrorAsync(10, exception, futureWithTrigger);
    try {
        futureWithTrigger.getFuture().trap(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);
    }
}