### Question:
DefaultTokenManager implements TokenManager { @Override public String getToken() { log.debug("DefaultTokenManager getToken()"); if (!checkCache()) { retrieveToken(); } if (token == null) { token = retrieveTokenFromCache(); } if (hasTokenExpired(token)) { token = retrieveTokenFromCache(); } if (isTokenExpiring(token) && !isAsyncInProgress()) { if (null != token.getRefresh_token()) { this.asyncInProgress = true; submitRefreshTask(); } else { retrieveToken(); token = retrieveTokenFromCache(); } } if (token.getAccess_token() != null && !token.getAccess_token().isEmpty()) { return token.getAccess_token(); } else if (token.getDelegated_refresh_token()!= null && !token.getDelegated_refresh_token().isEmpty()) { return token.getDelegated_refresh_token(); } else if (token.getIms_token() != null && !token.getIms_token().isEmpty()) { return token.getIms_token(); } else { return token.getUaa_token(); } } DefaultTokenManager(String apiKey);  DefaultTokenManager(TokenProvider provider); void setIamEndpoint(String iamEndpoint); void setIamRefreshOffset(double offset); void setIamMaxRetry(int count); TokenProvider getProvider(); @Override String getToken(); ClientConfiguration getClientConfiguration(); void setClientConfiguration(ClientConfiguration clientConfiguration); static void addProxyConfig(HttpClientBuilder builder,
			HttpClientSettings settings);  }### Answer:
@Test public void shouldAcceptTokenProvider() { TokenProvider tokenProvider = new TokenProviderUtil(); defaultTokenManager = new DefaultTokenManager(tokenProvider); assertEquals(defaultTokenManager.getToken(), ("ProviderAccessToken")); }
@Test(expected = Exception.class) public void shouldBubbleExceptionUpThroughSDK() { TokenProvider tokenProvider = null; defaultTokenManager = new DefaultTokenManager(tokenProvider); defaultTokenManager.getToken().equals("ProviderAccessToken"); }
@Test(expected = OAuthServiceException.class) public void shouldHandleNullTokenWithCorrectExcpetion() { DefaultTokenManager defaultTokenManager = new DefaultTokenManager(new TokenProviderNull()); defaultTokenManager.getToken(); }