@Test
public void testChaining() throws Exception {

    FutureWithTrigger<Integer> futureWithTrigger = new FutureWithTrigger<>();
    int initialValue = 1;
    Triggerer.triggerValueAsync(10, initialValue, futureWithTrigger);
    String result = futureWithTrigger.getFuture().mapFuture(i -> {
        //This will increase by one the test variable, after 10 milliseconds
        //Result should be 2
        FutureWithTrigger<Integer> next = new FutureWithTrigger<>();
        Triggerer.triggerValueAsync(10, initialValue + 1, next);
        return next.getFuture();
    }).map(
        //This will create a StringBuilder with the integer returned from the previous step
        //Result should be "2"
        i -> new StringBuilder(Integer.toString(i))
    ).consume(
        //This appends a "c" to the builder
        //Result should be "2c"
        s -> s.append("c")
    ).await().toString();
    //Proof that all was executed in sequence
    assertEquals("2c", result);
}