test_class.declarator: kmsHelper
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private KmsHelper kmsHelper;
test_class.type: KmsHelper
test_class.var_name: kmsHelper
test_class.file: herd-code/herd-dao/src/test/java/org/finra/herd/dao/helper/KmsHelperTest.java
test_class.identifier: KmsHelperTest
test_class.superclass: extends AbstractDaoTest
test_case.body: @Test
      public void testGetDecryptedConfigurationValueDecryptionError() throws Exception
      {
          Map<String, Object> overrideMap = new HashMap<>();
          overrideMap.put(ConfigurationValue.ACTIVITI_JOB_DEFINITION_ID_TEMPLATE.getKey(), MockKmsOperationsImpl.MOCK_CIPHER_TEXT_INVALID);
          modifyPropertySourceInEnvironment(overrideMap);
  
          try
          {
              kmsHelper.getDecryptedConfigurationValue(ConfigurationValue.ACTIVITI_JOB_DEFINITION_ID_TEMPLATE);
              fail("Suppose to throw an IllegalStateException when encrypted value is invalid.");
          }
          catch (IllegalStateException e)
          {
              assertEquals(String.format("Error decrypting configuration value \"%s\".", ConfigurationValue.ACTIVITI_JOB_DEFINITION_ID_TEMPLATE.getKey()),
                  e.getMessage());
          }
          finally
          {
              restorePropertySourceInEnvironment();
          }
      }
test_case.class_method_signature: KmsHelperTest.testGetDecryptedConfigurationValueDecryptionError()
test_case.full_signature: @Test public void testGetDecryptedConfigurationValueDecryptionError()
test_case.identifier: testGetDecryptedConfigurationValueDecryptionError
test_case.invocations: put getKey modifyPropertySourceInEnvironment getDecryptedConfigurationValue fail assertEquals format getKey getMessage restorePropertySourceInEnvironment
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetDecryptedConfigurationValueDecryptionError()
focal_class.declarator: configurationHelper
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private ConfigurationHelper configurationHelper;
focal_class.type: ConfigurationHelper
focal_class.var_name: configurationHelper
focal_class.declarator: awsHelper
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private AwsHelper awsHelper;
focal_class.type: AwsHelper
focal_class.var_name: awsHelper
focal_class.declarator: kmsDao
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private KmsDao kmsDao;
focal_class.type: KmsDao
focal_class.var_name: kmsDao
focal_class.file: herd-code/herd-dao/src/main/java/org/finra/herd/dao/helper/KmsHelper.java
focal_class.identifier: KmsHelper
focal_class.class_method_signature: KmsHelper.getDecryptedConfigurationValue(ConfigurationValue configurationValue)
focal_class.full_signature: public String getDecryptedConfigurationValue(ConfigurationValue configurationValue)
focal_class.identifier: getDecryptedConfigurationValue
focal_class.modifiers: public
focal_class.parameters: (ConfigurationValue configurationValue)
focal_class.return: String
focal_class.signature: String getDecryptedConfigurationValue(ConfigurationValue configurationValue)
focal_method.body: public String getDecryptedConfigurationValue(ConfigurationValue configurationValue)
      {
          String encryptedValue = configurationHelper.getProperty(configurationValue);
  
          if (StringUtils.isBlank(encryptedValue))
          {
              throw new IllegalStateException("Unable to decrypt configuration value \"" + configurationValue.getKey() + "\" since it is not configured.");
          }
  
          try
          {
              return kmsDao.decrypt(awsHelper.getAwsParamsDto(), encryptedValue);
          }
          catch (Exception e)
          {
              throw new IllegalStateException("Error decrypting configuration value \"" + configurationValue.getKey() + "\".", e);
          }
      }
focal_method.class_method_signature: KmsHelper.getDecryptedConfigurationValue(ConfigurationValue configurationValue)
focal_method.full_signature: public String getDecryptedConfigurationValue(ConfigurationValue configurationValue)
focal_method.identifier: getDecryptedConfigurationValue
focal_method.invocations: getProperty isBlank getKey decrypt getAwsParamsDto getKey
focal_method.modifiers: public
focal_method.parameters: (ConfigurationValue configurationValue)
focal_method.return: String
focal_method.signature: String getDecryptedConfigurationValue(ConfigurationValue configurationValue)