### Question:
CodeAuthorizationResponseHandler implements AuthorizationEndpointResponseHandler { public boolean handlesRequest(final OAuth2Accessor accessor, final HttpServletRequest request) { if (accessor == null) { return false; } else if (request == null) { return false; } else if (!accessor.isValid() || accessor.isErrorResponse() || !accessor.isRedirecting()) { return false; } else if (!accessor.getGrantType().equalsIgnoreCase(OAuth2Message.AUTHORIZATION)) { return false; } return true; } @Inject  CodeAuthorizationResponseHandler(final Provider<OAuth2Message> oauth2MessageProvider,
          final List<ClientAuthenticationHandler> clientAuthenticationHandlers,
          final List<TokenEndpointResponseHandler> tokenEndpointResponseHandlers,
          final HttpFetcher fetcher); OAuth2HandlerError handleRequest(final OAuth2Accessor accessor,
          final HttpServletRequest request); OAuth2HandlerError handleResponse(final OAuth2Accessor accessor,
          final HttpResponse response); boolean handlesRequest(final OAuth2Accessor accessor, final HttpServletRequest request); boolean handlesResponse(final OAuth2Accessor accessor, final HttpResponse response);  }### Answer:
@Test public void testHandlesRequest_1() throws Exception { final CodeAuthorizationResponseHandler fixture = CodeAuthorizationResponseHandlerTest.carh; final OAuth2Accessor accessor = MockUtils.getOAuth2Accessor_Code(); final HttpServletRequest request = null; final boolean result = fixture.handlesRequest(accessor, request); Assert.assertEquals(false, result); }
@Test public void testHandlesRequest_2() throws Exception { final CodeAuthorizationResponseHandler fixture = CodeAuthorizationResponseHandlerTest.carh; final OAuth2Accessor accessor = MockUtils.getOAuth2Accessor_Redirecting(); final HttpServletRequest request = new DummyHttpServletRequest(); final boolean result = fixture.handlesRequest(accessor, request); Assert.assertTrue(result); }
@Test public void testHandlesRequest_3() throws Exception { final CodeAuthorizationResponseHandler fixture = CodeAuthorizationResponseHandlerTest.carh; final OAuth2Accessor accessor = null; final HttpServletRequest request = new DummyHttpServletRequest(); final boolean result = fixture.handlesRequest(accessor, request); Assert.assertEquals(false, result); }
@Test public void testHandlesRequest_4() throws Exception { final CodeAuthorizationResponseHandler fixture = CodeAuthorizationResponseHandlerTest.carh; final OAuth2Accessor accessor = MockUtils.getOAuth2Accessor_Code(); final HttpServletRequest request = new DummyHttpServletRequest(); final boolean result = fixture.handlesRequest(accessor, request); Assert.assertEquals(false, result); }