BAEL-6277 - A Guide To Spring Cloud Azure Key Vault

fix compilation of NoSuchElementException
This commit is contained in:
Cesare
2023-04-01 13:02:14 +02:00
parent f420402d70
commit a9e8e3c44f
2 changed files with 2 additions and 4 deletions

View File

@@ -14,7 +14,7 @@ public interface KeyVaultClient {
try {
secret = getSecretClient().getSecret(key);
} catch (Exception ex) {
throw new NoSuchElementException(String.format("Unable to retrieve %s secret", key), ex);
throw new NoSuchElementException();
}
return secret;
}

View File

@@ -20,9 +20,7 @@ public class KeyVaultAutoconfiguredClientUnitTest {
@Test
void whenANotExistingKeyIsProvided_thenShouldReturnAnError() {
String secretKey = "mySecret";
Assertions.assertThrows(NoSuchElementException.class, () -> {
keyVaultAutoconfiguredClient.getSecret(secretKey);
});
Assertions.assertThrows(NoSuchElementException.class, () -> keyVaultAutoconfiguredClient.getSecret(secretKey));
}
}