@Test public void testEmptyProfileReturned(final TestContext testContext) { when(client.getCredentials(any(AsyncWebContext.class))).thenReturn(delayedResult(() -> TEST_CREDENTIALS)); when(client.getUserProfileFuture(TEST_CREDENTIALS, webContext)).thenReturn(delayedResult(() -> Optional.empty())); final Async async = testContext.async(); authenticator.authenticateFor(client, webContext) .thenAccept(o -> executionContext.runOnContext(() -> { assertThat(o.isPresent(), is(false)); async.complete(); })); }
public <P extends U, C extends Credentials> CompletableFuture<Optional<P>> authenticateFor(final AsyncClient<C, P> client, final WC webContext) { return client.getCredentials(webContext) .thenCompose(c -> client.getUserProfileFuture(c, webContext)); }
AsyncClientAuthenticator { public <P extends U, C extends Credentials> CompletableFuture<Optional<P>> authenticateFor(final AsyncClient<C, P> client, final WC webContext) { return client.getCredentials(webContext) .thenCompose(c -> client.getUserProfileFuture(c, webContext)); } }
AsyncClientAuthenticator { public <P extends U, C extends Credentials> CompletableFuture<Optional<P>> authenticateFor(final AsyncClient<C, P> client, final WC webContext) { return client.getCredentials(webContext) .thenCompose(c -> client.getUserProfileFuture(c, webContext)); }  }
AsyncClientAuthenticator { public <P extends U, C extends Credentials> CompletableFuture<Optional<P>> authenticateFor(final AsyncClient<C, P> client, final WC webContext) { return client.getCredentials(webContext) .thenCompose(c -> client.getUserProfileFuture(c, webContext)); }  CompletableFuture<Optional<P>> authenticateFor(final AsyncClient<C, P> client,
                                                                                               final WC webContext); }
AsyncClientAuthenticator { public <P extends U, C extends Credentials> CompletableFuture<Optional<P>> authenticateFor(final AsyncClient<C, P> client, final WC webContext) { return client.getCredentials(webContext) .thenCompose(c -> client.getUserProfileFuture(c, webContext)); }  CompletableFuture<Optional<P>> authenticateFor(final AsyncClient<C, P> client,
                                                                                               final WC webContext);  }