@Test
void testValidToken() throws NoSuchFieldException, IllegalAccessException, IOException {

    String resource = "resource";
    String accessToken = "accessToken";
    Field tokensField = CertificateCredentials.class.getDeclaredField("tokens");
    tokensField.setAccessible(true);
    CertificateCredentials credentials = new CertificateCredentials(domain,
        environment, mock(AsymmetricKeyCredentialFactory.class));
    Map<String, AuthenticationResult> tokens =
        (Map<String, AuthenticationResult>)tokensField.get(credentials);
    AuthenticationResult authenticationResult = new AuthenticationResult(
        "accessTokenType", accessToken, "refreshToken", 1000, "idToken", null, false);
    tokens.put(resource, authenticationResult);
    String token = credentials.getToken(resource);
    Assertions.assertEquals(accessToken, token);
}