### Question:
EncryptedSecret { public static EncryptedSecret parse(String secretConfig) { if (EncryptedSecret.isEncryptedSecret(secretConfig)) { return new EncryptedSecret(secretConfig); } return null; } EncryptedSecret(String secretConfig); static EncryptedSecret parse(String secretConfig); static boolean isEncryptedSecret(String secretConfig); static boolean isEncryptedFile(String secretConfig); static final String ENCRYPTED_STRING_PREFIX; static final String ENCRYPTED_FILE_PREFIX; }### Answer:
@Test public void parseSecretConfigValue() { String secretConfig = "encrypted:s3!first:key!second:another-valu:e!3rd:yetAnothervalue"; EncryptedSecret encryptedSecret = EncryptedSecret.parse(secretConfig); assertEquals("s3", encryptedSecret.getEngineIdentifier()); }
@Test public void parseSecretFileConfigValue() { String secretConfig = "encryptedFile:s3!first:key!second:another-valu:e!3rd:yetAnothervalue"; EncryptedSecret encryptedSecret = EncryptedSecret.parse(secretConfig); assertEquals("s3", encryptedSecret.getEngineIdentifier()); }
@Test public void parseNotSecretConfigValue() { String secretConfig = "invalid config value"; EncryptedSecret encryptedSecret = EncryptedSecret.parse(secretConfig); assertEquals(null, encryptedSecret); }