### Question:
DkbAccessTokenService implements AccessTokenService { @Override public String retrieveToken() { if (isNotValid()) { logger.debug("Token is not valid"); Response<TokenResponse> response = httpClient.post(tokenUrl) .urlEncodedBody(Collections.singletonMap("grant_type", "client_credentials")) .headers(headers) .send(responseHandler()); logger.debug("New token is retrieved"); accessToken = new AccessToken(response.getBody()); } return accessToken.token; } private  DkbAccessTokenService(); static synchronized DkbAccessTokenService getInstance(); @Override String retrieveToken(); void setHttpClient(HttpClient httpClient); static final String DKB_TOKEN_CONSUMER_KEY_PROPERTY; static final String DKB_TOKEN_CONSUMER_SECRET_PROPERTY; }### Answer:
@Test void retrieveToken() { String accessToken = "accessToken"; DkbAccessTokenService.TokenResponse tokenResponse = new DkbAccessTokenService.TokenResponse(accessToken, 3600); when(httpClient.send(any(), any())).thenReturn(new Response<>(200, tokenResponse, ResponseHeaders.fromMap(Collections.emptyMap()))); when(httpClient.post(any())).thenReturn(new RequestBuilderImpl(httpClient, "POST", "")); String token = tokenService.retrieveToken(); verify(httpClient, times(1)).send(any(), any()); assertThat(token).isEqualTo(accessToken); }