### Question:
OAuthUtil { public HttpRequest2 createSignedRequest(HttpRequest2 httpRequest) { Validate.notNull(httpRequest, "httpRequest must not be null"); HttpRequest2Builder builder = new HttpRequest2Builder(httpRequest.getMethod(), httpRequest.getUrl()); builder.addHeaders(httpRequest.getHeaders()); builder.addHeader( AUTHORIZATION_HEADER_KEY, createAuthorization(httpRequest.getMethod(), UrlHelper.parseBaseUrl(httpRequest.getUrl()), UrlHelper.parseParams(httpRequest.getUrl()))); builder.setEntity(httpRequest.getEntity()); return builder.create(); } OAuthUtil(OAuthParams params); HttpRequest2 createSignedRequest(HttpRequest2 httpRequest); String createAuthorization(HttpMethod method, String url, List<? extends Entry<String, String>> params); static final String AUTHORIZATION_HEADER_KEY; }### Answer:
@Test public void testCreateSignedRequest() { HttpRequest2 signedRequest = OATH_UTIL_UNDER_TEST.createSignedRequest(HTTP_REQUEST); assertEquals(BASE_URL, signedRequest.getUrl()); assertEquals(HTTP_METHOD, signedRequest.getMethod()); assertEquals(1, signedRequest.getHeaders().size()); assertEquals(EXPECTED_AUTHORIZATION_PARAM, signedRequest.getHeaders().get("Authorization")); }