@Test
  public void when_header_extract_access_token() throws Exception {
    // GIVEN
    String header = "Bearer ab1f63c52d1bb435f1d9c97c805b6a04d62cbbad7f1876038cd9f5362c37ac5a1";

    // WHEN
    String accessToken = AccessTokenValidator.extractAccessToken(header);

    // THEN
    assertEquals(accessToken, "ab1f63c52d1bb435f1d9c97c805b6a04d62cbbad7f1876038cd9f5362c37ac5a1");
  }
  @Test
  public void when_endpoint_scope_same_as_token_scope_retunr_true() throws Exception {
    // GIVEN
    String tokenResponse = "{\"scope\":\"basic\",\"token_type\":\"Bearer\",\"userId\":\"12345\"}";

    // WHEN
    boolean result = AccessTokenValidator.validateTokenScope(tokenResponse, "basic");

    // THEN
    assertTrue(result);
  }
  @Test
  public void when_token_response_contain_null_scope_return_null_as_scope() throws Exception {
    // GIVEN
    String tokenContent =
        "{\"tokenType\":\"599\","
            + "\"accessToken\":\"da96c8141bcda91be65db4adbc8fafe77d116c88caacb8de404c0654c16c6620\","
            + "\"expiresIn\":\"Bearer\",\"userId\":null,"
            + "\"refreshToken\":\"cb2e2e068447913d0c97f79f888f6e2882bfcb569325a9ad9e9b52937b06e547\"}";

    // WHEN
    String tokenScope = AccessTokenValidator.extractTokenScope(tokenContent);

    // THEN
    assertNull(tokenScope);
  }
  @Test
  public void when_token_but_scope_is_null_return_true() throws Exception {
    // GIVEN
    String endpointScope = null;
    String tokenContent =
        "{\"tokenType\":\"599\",\"scope\":\"basic other\","
            + "\"accessToken\":\"da96c8141bcda91be65db4adbc8fafe77d116c88caacb8de404c0654c16c6620\","
            + "\"expiresIn\":\"Bearer\",\"userId\":null,"
            + "\"refreshToken\":\"cb2e2e068447913d0c97f79f888f6e2882bfcb569325a9ad9e9b52937b06e547\"}";

    // WHEN
    boolean result = AccessTokenValidator.validateTokenScope(tokenContent, endpointScope);

    // THEN
    assertTrue(result);
  }