@Test
public void testGetNow() throws Throwable {

    TestContext ctx = new TestContext(1, TestContext.DEFAULT_WAIT_DURATION);
    TestContext synchCtx = new TestContext(1, TestContext.DEFAULT_WAIT_DURATION);
    int value = 10;
    DeferredResult<Integer> deferredResult = new DeferredResult<>();
    deferredResult.whenComplete(ctx.getCompletionDeferred());
    runAfter(synchCtx, () -> deferredResult.complete(value));
    try {
        deferredResult.getNow(exceptionSupplier("expected"));
        Assert.fail();
    } catch (RuntimeException e) {
        Assert.assertEquals("expected", e.getMessage());
    }
    synchCtx.complete();
    ctx.await();
    Assert.assertEquals(value, deferredResult.getNow(exceptionSupplier()).intValue());
}