### Question:
BearerTokenExtractor { public String getAccessToken(final String authorizationHeader) { if (authorizationHeader == null) { return null; } String authorization = authorizationHeader.trim(); final int index = authorization.indexOf(' '); if (index <= 0) { return null; } final String tokenType = authorization.substring(0, index); if (BEARER_TOKEN_KEY.equalsIgnoreCase(tokenType)) { return authorization.substring(index + 1); } return null; }  String getAccessToken(final String authorizationHeader);  }### Answer:
@Test(dataProvider = "validHeaders") public void shouldExtractTheTokenValue(String header) throws Exception { BearerTokenExtractor extractor = new BearerTokenExtractor(); assertThat(extractor.getAccessToken(header)).isEqualTo("token"); }
@Test(dataProvider = "invalidHeaders") public void shouldNotReturnABearerToken(String header) throws Exception { BearerTokenExtractor extractor = new BearerTokenExtractor(); assertThat(extractor.getAccessToken(header)).isNull(); }