ApiHttpUtils { public static HttpHeaders getHeaders(String token) { HttpHeaders headers = new HttpHeaders(); String creds = new String(Base64.encodeBase64((token + ":").getBytes())); headers.add("Authorization", "Basic " + creds); headers.add("Accept", "application/json"); return headers; } private  ApiHttpUtils(); static HttpHeaders getHeaders(String token);  }
@Test public void testHeaders() { final HttpHeaders headers = ApiHttpUtils.getHeaders(TOKEN_VALUE); final String token64 = new String(Base64.encodeBase64((TOKEN_VALUE + ":").getBytes())); assertEquals(Collections.singletonList(MediaType.APPLICATION_JSON), headers.getAccept()); assertEquals("Basic " + token64, headers.get("Authorization").get(0)); }