test_class.file: herd-code/herd-tools/herd-tools-common/src/test/java/org/finra/herd/tools/common/databridge/AutoRefreshCredentialProviderTest.java
test_class.identifier: AutoRefreshCredentialProviderTest
test_class.superclass: extends AbstractCoreTest
test_case.body: @Test
      public void testAssertException()
      {
          AutoRefreshCredentialProvider autoRefreshCredentialProvider = new AutoRefreshCredentialProvider()
          {
              @Override
              public AwsCredential getNewAwsCredential() throws Exception
              {
                  throw new Exception("test");
              }
          };
  
          try
          {
              executeWithoutLogging(AutoRefreshCredentialProvider.class, () -> {
                  autoRefreshCredentialProvider.getAwsCredential();
              });
              fail();
          }
          catch (Exception e)
          {
              assertEquals(IllegalStateException.class, e.getClass());
              Throwable cause = e.getCause();
              assertEquals(Exception.class, cause.getClass());
              assertEquals("test", cause.getMessage());
          }
      }
test_case.class_method_signature: AutoRefreshCredentialProviderTest.testAssertException()
test_case.full_signature: @Test public void testAssertException()
test_case.identifier: testAssertException
test_case.invocations: executeWithoutLogging getAwsCredential fail assertEquals getClass getCause assertEquals getClass assertEquals getMessage
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testAssertException()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(AutoRefreshCredentialProvider.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(AutoRefreshCredentialProvider.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: sessionExpirationTime
focal_class.modifier: private
focal_class.original_string: private Long sessionExpirationTime;
focal_class.type: Long
focal_class.var_name: sessionExpirationTime
focal_class.declarator: currentAwsCredentials
focal_class.modifier: private
focal_class.original_string: private AwsCredential currentAwsCredentials;
focal_class.type: AwsCredential
focal_class.var_name: currentAwsCredentials
focal_class.file: herd-code/herd-tools/herd-tools-common/src/main/java/org/finra/herd/tools/common/databridge/AutoRefreshCredentialProvider.java
focal_class.identifier: AutoRefreshCredentialProvider
focal_class.interfaces: implements HerdAWSCredentialsProvider
focal_class.class_method_signature: AutoRefreshCredentialProvider.getNewAwsCredential()
focal_class.full_signature: public abstract AwsCredential getNewAwsCredential()
focal_class.identifier: getNewAwsCredential
focal_class.modifiers: public abstract
focal_class.parameters: ()
focal_class.return: AwsCredential
focal_class.signature: AwsCredential getNewAwsCredential()
focal_class.class_method_signature: AutoRefreshCredentialProvider.getAwsCredential()
focal_class.full_signature: @Override public AwsCredential getAwsCredential()
focal_class.identifier: getAwsCredential
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: AwsCredential
focal_class.signature: AwsCredential getAwsCredential()
focal_method.body: @Override
      public AwsCredential getAwsCredential()
      {
          if (sessionExpirationTime == null || System.currentTimeMillis() >= sessionExpirationTime)
          {
              try
              {
                  currentAwsCredentials = getNewAwsCredential();
              }
              catch (Exception e)
              {
                  LOGGER.warn("Error retrieving new credentials. {}", e.toString(), e);
                  throw new IllegalStateException(e);
              }
              sessionExpirationTime = currentAwsCredentials.getAwsSessionExpirationTime().toGregorianCalendar().getTimeInMillis();
          }
          return currentAwsCredentials;
      }
focal_method.class_method_signature: AutoRefreshCredentialProvider.getAwsCredential()
focal_method.full_signature: @Override public AwsCredential getAwsCredential()
focal_method.identifier: getAwsCredential
focal_method.invocations: currentTimeMillis getNewAwsCredential warn toString getTimeInMillis toGregorianCalendar getAwsSessionExpirationTime
focal_method.modifiers: @Override public
focal_method.parameters: ()
focal_method.return: AwsCredential
focal_method.signature: AwsCredential getAwsCredential()