test_class.declarator: domain = "domain"
test_class.original_string: String domain = "domain";
test_class.type: String
test_class.var_name: domain
test_class.declarator: environment = AzureEnvironment.AZURE
test_class.original_string: AzureEnvironment environment = AzureEnvironment.AZURE;
test_class.type: AzureEnvironment
test_class.var_name: environment
test_class.file: nvadaemon-azure/src/test/java/com/microsoft/azure/practices/nvadaemon/credentials/CertificateCredentialsTest.java
test_class.identifier: CertificateCredentialsTest
test_case.body: @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);
      }
test_case.class_method_signature: CertificateCredentialsTest.testValidToken()
test_case.full_signature: @Test void testValidToken()
test_case.identifier: testValidToken
test_case.invocations: getDeclaredField setAccessible mock get put getToken assertEquals
test_case.modifiers: @Test
test_case.parameters: ()
test_case.return: void
test_case.signature: void testValidToken()
focal_class.declarator: tokens
focal_class.modifier: private
focal_class.original_string: private Map<String, AuthenticationResult> tokens;
focal_class.type: Map<String, AuthenticationResult>
focal_class.var_name: tokens
focal_class.declarator: domain
focal_class.modifier: private
focal_class.original_string: private String domain;
focal_class.type: String
focal_class.var_name: domain
focal_class.declarator: environment
focal_class.modifier: private
focal_class.original_string: private AzureEnvironment environment;
focal_class.type: AzureEnvironment
focal_class.var_name: environment
focal_class.declarator: credentialFactory
focal_class.modifier: private
focal_class.original_string: private AsymmetricKeyCredentialFactory credentialFactory;
focal_class.type: AsymmetricKeyCredentialFactory
focal_class.var_name: credentialFactory
focal_class.file: nvadaemon-azure/src/main/java/com/microsoft/azure/practices/nvadaemon/credentials/CertificateCredentials.java
focal_class.identifier: CertificateCredentials
focal_class.interfaces: implements AzureTokenCredentials
focal_class.class_method_signature: CertificateCredentials.CertificateCredentials(String domain, AzureEnvironment environment,
                                    AsymmetricKeyCredentialFactory credentialFactory)
focal_class.full_signature: public  CertificateCredentials(String domain, AzureEnvironment environment,
                                    AsymmetricKeyCredentialFactory credentialFactory)
focal_class.identifier: CertificateCredentials
focal_class.modifiers: public
focal_class.parameters: (String domain, AzureEnvironment environment,
                                    AsymmetricKeyCredentialFactory credentialFactory)
focal_class.signature:  CertificateCredentials(String domain, AzureEnvironment environment,
                                    AsymmetricKeyCredentialFactory credentialFactory)
focal_class.class_method_signature: CertificateCredentials.getDomain()
focal_class.full_signature: @Override public String getDomain()
focal_class.identifier: getDomain
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getDomain()
focal_class.class_method_signature: CertificateCredentials.getEnvironment()
focal_class.full_signature: @Override public AzureEnvironment getEnvironment()
focal_class.identifier: getEnvironment
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: AzureEnvironment
focal_class.signature: AzureEnvironment getEnvironment()
focal_class.class_method_signature: CertificateCredentials.getToken(String resource)
focal_class.full_signature: @Override public String getToken(String resource)
focal_class.identifier: getToken
focal_class.modifiers: @Override public
focal_class.parameters: (String resource)
focal_class.return: String
focal_class.signature: String getToken(String resource)
focal_class.class_method_signature: CertificateCredentials.acquireAccessToken(String resource)
focal_class.full_signature: private AuthenticationResult acquireAccessToken(String resource)
focal_class.identifier: acquireAccessToken
focal_class.modifiers: private
focal_class.parameters: (String resource)
focal_class.return: AuthenticationResult
focal_class.signature: AuthenticationResult acquireAccessToken(String resource)
focal_class.class_method_signature: CertificateCredentials.applyCredentialsFilter(OkHttpClient.Builder clientBuilder)
focal_class.full_signature: public void applyCredentialsFilter(OkHttpClient.Builder clientBuilder)
focal_class.identifier: applyCredentialsFilter
focal_class.modifiers: public
focal_class.parameters: (OkHttpClient.Builder clientBuilder)
focal_class.return: void
focal_class.signature: void applyCredentialsFilter(OkHttpClient.Builder clientBuilder)
focal_class.superclass: extends TokenCredentials
focal_method.body: @Override
      public String getToken(String resource) throws IOException {
          AuthenticationResult authenticationResult = this.tokens.get(resource);
          if(authenticationResult == null || authenticationResult.getExpiresOnDate().before(new Date())) {
              authenticationResult = this.acquireAccessToken(resource);
          }
  
          return authenticationResult.getAccessToken();
      }
focal_method.class_method_signature: CertificateCredentials.getToken(String resource)
focal_method.full_signature: @Override public String getToken(String resource)
focal_method.identifier: getToken
focal_method.invocations: get before getExpiresOnDate acquireAccessToken getAccessToken
focal_method.modifiers: @Override public
focal_method.parameters: (String resource)
focal_method.return: String
focal_method.signature: String getToken(String resource)