@Test public void createWithAuthorizationBearerHeader_containsDefaultHeadersAndToken() { HttpHeaders headers = HttpHeadersFactory.createWithAuthorizationBearerHeader(TOKEN); assertThat(headers.getHeaders()).hasSize(3); assertThat(headers.getHeaders()).contains(ACCEPT_JSON_HEADER, CONTENT_TYPE_URL_ENCODED); HttpHeader tokenHeader = new HttpHeader(AUTHORIZATION, "Bearer " + TOKEN); assertThat(headers.getHeaders()).contains(tokenHeader); }
public static HttpHeaders createWithAuthorizationBearerHeader(String token) { Map<String, String> headers = createDefaultHeaders(); final String AUTHORIZATION_BEARER_TOKEN_FORMAT = "Bearer %s"; headers.put(HttpHeaders.AUTHORIZATION, String.format(AUTHORIZATION_BEARER_TOKEN_FORMAT, token)); return createFromHeaders(headers); }
HttpHeadersFactory { public static HttpHeaders createWithAuthorizationBearerHeader(String token) { Map<String, String> headers = createDefaultHeaders(); final String AUTHORIZATION_BEARER_TOKEN_FORMAT = "Bearer %s"; headers.put(HttpHeaders.AUTHORIZATION, String.format(AUTHORIZATION_BEARER_TOKEN_FORMAT, token)); return createFromHeaders(headers); } }
HttpHeadersFactory { public static HttpHeaders createWithAuthorizationBearerHeader(String token) { Map<String, String> headers = createDefaultHeaders(); final String AUTHORIZATION_BEARER_TOKEN_FORMAT = "Bearer %s"; headers.put(HttpHeaders.AUTHORIZATION, String.format(AUTHORIZATION_BEARER_TOKEN_FORMAT, token)); return createFromHeaders(headers); } private  HttpHeadersFactory(); }
HttpHeadersFactory { public static HttpHeaders createWithAuthorizationBearerHeader(String token) { Map<String, String> headers = createDefaultHeaders(); final String AUTHORIZATION_BEARER_TOKEN_FORMAT = "Bearer %s"; headers.put(HttpHeaders.AUTHORIZATION, String.format(AUTHORIZATION_BEARER_TOKEN_FORMAT, token)); return createFromHeaders(headers); } private  HttpHeadersFactory(); static HttpHeaders createWithAuthorizationBearerHeader(String token); static HttpHeaders createWithoutAuthorizationHeader(); }
HttpHeadersFactory { public static HttpHeaders createWithAuthorizationBearerHeader(String token) { Map<String, String> headers = createDefaultHeaders(); final String AUTHORIZATION_BEARER_TOKEN_FORMAT = "Bearer %s"; headers.put(HttpHeaders.AUTHORIZATION, String.format(AUTHORIZATION_BEARER_TOKEN_FORMAT, token)); return createFromHeaders(headers); } private  HttpHeadersFactory(); static HttpHeaders createWithAuthorizationBearerHeader(String token); static HttpHeaders createWithoutAuthorizationHeader();  }