HttpHeadersUtils { public static HttpHeaders setHeaders(HttpHeaders headers, Map<String, String> headersMap) { for (Map.Entry<String, String> entry : headersMap.entrySet()) { setHeader(headers, entry.getKey(), entry.getValue()); } return headers; }  static String getUserAgentValue(Map<String, String> headersMap); static HttpHeaders setHeaders(HttpHeaders headers, Map<String, String> headersMap); static HttpHeaders setHeader(HttpHeaders headers, String key, String value);  }
@Test public void testSetHeaders() { HttpHeaders headers = new HttpHeaders(); Map<String, String> headersMap = ImmutableMap.of( "Custom-Header", "CustomHeader", "accept", "Accept", "Content-Length", "123"); assertEquals(headers, HttpHeadersUtils.setHeaders(headers, headersMap)); assertEquals("CustomHeader", headers.get("Custom-Header")); assertEquals("Accept", headers.getAccept()); assertEquals(Long.valueOf(123L), headers.getContentLength()); }