### Question:
TokenResponseTypeHandler implements ResponseTypeHandler { @Override public Map.Entry<String, Token> handle(String tokenType, Set<String> scope, ResourceOwner resourceOwner, String clientId, String redirectUri, String nonce, OAuth2Request request, String codeChallenge, String codeChallengeMethod) throws ServerException, NotFoundException { String claims = null; if (request.getParameter(OAuth2Constants.Params.CODE) == null) { claims = request.getParameter(OAuth2Constants.Custom.CLAIMS); } final AccessToken generatedAccessToken = tokenStore.createAccessToken(TOKEN, tokenType, null, resourceOwner.getId(), clientId, redirectUri, scope, null, nonce, claims, request); return new AbstractMap.SimpleEntry<String, Token>(ACCESS_TOKEN, generatedAccessToken); } @Inject  TokenResponseTypeHandler(TokenStore tokenStore); @Override Map.Entry<String, Token> handle(String tokenType, Set<String> scope, ResourceOwner resourceOwner,
                                           String clientId, String redirectUri, String nonce, OAuth2Request request,
                                           String codeChallenge, String codeChallengeMethod); OAuth2Constants.UrlLocation getReturnLocation();  }### Answer:
@Test public void shouldHandle() throws Exception { String grantType = "token"; String tokenType = "TOKEN_TYPE"; String authorizationCode = null; Set<String> scope = new HashSet<String>(); ResourceOwner resourceOwner = mock(ResourceOwner.class); String clientId = "CLIENT_ID"; String redirectUri = "REDIRECT_URI"; String claims = null; RefreshToken refreshToken = null; String nonce = "NONCE"; OAuth2Request request = mock(OAuth2Request.class); AccessToken accessToken = mock(AccessToken.class); given(tokenStore.createAccessToken(grantType, tokenType, authorizationCode, resourceOwner.getId(), clientId, redirectUri, scope, refreshToken, nonce, claims, request)).willReturn(accessToken); final Map.Entry<String, Token> tokenEntry = responseTypeHandler.handle(tokenType, scope, resourceOwner, clientId, redirectUri, nonce, request, null, null); assertEquals(tokenEntry.getKey(), "access_token"); assertEquals(tokenEntry.getValue(), accessToken); }