### Question:
BearerTokenHandler implements ResourceRequestHandler { public OAuth2HandlerError addOAuth2Params(final OAuth2Accessor accessor, final HttpRequest request) { try { if (accessor == null || !accessor.isValid() || accessor.isErrorResponse()) { return BearerTokenHandler.getError("accessor is invalid " + accessor); } if (request == null) { return BearerTokenHandler.getError("request is null"); } final Uri unAuthorizedRequestUri = request.getUri(); if (unAuthorizedRequestUri == null) { return BearerTokenHandler.getError("unAuthorizedRequestUri is null"); } final OAuth2Token accessToken = accessor.getAccessToken(); if (accessToken == null || accessToken.getTokenType().length() == 0) { return BearerTokenHandler.getError("accessToken is invalid " + accessToken); } if (!BearerTokenHandler.TOKEN_TYPE.equalsIgnoreCase(accessToken.getTokenType())) { return BearerTokenHandler.getError("token type mismatch expected " + BearerTokenHandler.TOKEN_TYPE + " but got " + accessToken.getTokenType()); } if (accessor.isUrlParameter()) { final Map<String, String> queryParams = Maps.newHashMap(); final byte[] secretBytes = accessToken.getSecret(); final String secret = new String(secretBytes, "UTF-8"); queryParams.put(OAuth2Message.ACCESS_TOKEN, secret); final String authorizedUriString = OAuth2Utils.buildUrl(unAuthorizedRequestUri.toString(), queryParams, null); request.setUri(Uri.parse(authorizedUriString)); } if (accessor.isAuthorizationHeader()) { request.setHeader("Authorization", BearerTokenHandler.TOKEN_TYPE + ' ' + new String(accessToken.getSecret(), "UTF-8")); } return null; } catch (final Exception e) { return BearerTokenHandler.getError("Exception occurred " + e.getMessage(), e); } }  OAuth2HandlerError addOAuth2Params(final OAuth2Accessor accessor, final HttpRequest request); String getTokenType(); static final String TOKEN_TYPE; }### Answer:
@Test public void testAddOAuth2Params_6() throws Exception { final BearerTokenHandler fixture = new BearerTokenHandler(); final OAuth2Accessor accessor = MockUtils.getOAuth2Accessor_Code(); final HttpRequest request = new HttpRequest(Uri.parse(MockUtils.GADGET_URI1)); final OAuth2HandlerError result = fixture.addOAuth2Params(accessor, request); Assert.assertNull(result); final String authHeader = request.getHeader("Authorization"); Assert.assertNotNull(authHeader); Assert.assertEquals("Bearer accessSecret", authHeader); }