@Test
public void testAccessTokenIsCached() {

    CompletableFuture<String> tokenFuture = CompletableFuture.completedFuture(TOKEN);
    expectTokenRequest(tokenFuture);
    AccessToken accessToken1 = tokenProvider.obtainAccessToken().join();
    AccessToken accessToken2 = tokenProvider.obtainAccessToken().join();
    assertThat(accessToken2).isSameAs(accessToken1);
    verify(authClient).getOAuth2AccessToken();  // exactly once
}