### Question:
MacTokenHandler implements ResourceRequestHandler { public OAuth2HandlerError addOAuth2Params(final OAuth2Accessor accessor, final HttpRequest request) { try { final OAuth2HandlerError handlerError = MacTokenHandler.validateOAuth2Params(accessor, request); if (handlerError != null) { return handlerError; } final OAuth2Token accessToken = accessor.getAccessToken(); String ext = accessToken.getMacExt(); if (ext == null || ext.length() == 0) { ext = ""; } final String id = new String(accessToken.getSecret(), "UTF-8"); final long currentTime = System.currentTimeMillis() / 1000; final String nonce = Long.toString(currentTime - accessToken.getIssuedAt()) + ':' + String.valueOf(Math.abs(Crypto.RAND.nextLong())); String bodyHash = MacTokenHandler.getBodyHash(request, accessToken.getMacSecret(), accessToken.getMacAlgorithm()); if (bodyHash == null) { bodyHash = ""; } final Uri uri = request.getUri(); String uriString = uri.getPath(); if (uri.getQuery() != null) { uriString = uriString + '?' + uri.getQuery(); } String host = uri.getAuthority(); String port = "80"; final int index = host.indexOf(':'); if (index > 0) { port = host.substring(index + 1); host = host.substring(0, index); } else { final String scheme = uri.getScheme(); if ("https".equals(scheme)) { port = "443"; } } final String mac = MacTokenHandler.getMac(nonce, request.getMethod(), uriString, host, port, bodyHash, ext, accessToken.getMacSecret(), accessToken.getMacAlgorithm()); final String headerString = buildHeaderString(id, nonce, bodyHash, ext, mac); request.setHeader(OAuth2Message.AUTHORIZATION_HEADER, headerString); return null; } catch (final Exception e) { return MacTokenHandler.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_5() throws Exception { final MacTokenHandler fixture = new MacTokenHandler(); final OAuth2Accessor accessor = MockUtils.getOAuth2Accessor_MacToken(); final HttpRequest request = new HttpRequest(Uri.fromJavaUri(new URI( "http: request.setMethod(""); final OAuth2HandlerError result = fixture.addOAuth2Params(accessor, request); Assert.assertNull(result); final String authHeader = request.getHeader("Authorization"); Assert.assertNotNull(authHeader); Assert.assertTrue(authHeader.startsWith("MAC id = \"accessSecret\",nonce=")); }