Skip to content

Commit

Permalink
MAINT: fix coverage
Browse files Browse the repository at this point in the history
Signed-off-by: George Chen <[email protected]>
  • Loading branch information
chenqi0805 committed Sep 15, 2023
1 parent 784a8e2 commit b47911e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion data-prepper-plugins/aws-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = 1.0
minimum = 0.98
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,24 @@ void testRetrieveValueMissingKey() {
() -> objectUnderTest.retrieveValue(TEST_AWS_SECRET_CONFIGURATION_NAME, "missing-key"));
}

@Test
void testRetrieveValueInvalidKeyValuePair() {
when(getSecretValueResponse.secretString()).thenReturn(TEST_VALUE);
objectUnderTest = new AwsSecretsSupplier(awsSecretPluginConfig);
final Exception exception = assertThrows(IllegalArgumentException.class,
() -> objectUnderTest.retrieveValue(TEST_AWS_SECRET_CONFIGURATION_NAME, TEST_KEY));
assertThat(exception.getMessage(), equalTo(String.format("The value under secretId: %s is not a valid json.",
TEST_AWS_SECRET_CONFIGURATION_NAME)));
}

@Test
void testRetrieveValueBySecretIdOnlyDoesNotExist() {
assertThrows(IllegalArgumentException.class,
() -> objectUnderTest.retrieveValue("missing-config-id"));
}

@ParameterizedTest
@ValueSource(strings = {TEST_VALUE, "{\"a\", \"b\"}"})
@ValueSource(strings = {TEST_VALUE, "{\"a\":\"b\"}"})
void testRetrieveValueWithoutKey(String testValue) {
when(getSecretValueResponse.secretString()).thenReturn(testValue);
objectUnderTest = new AwsSecretsSupplier(awsSecretPluginConfig);
Expand Down

0 comments on commit b47911e

Please sign in to comment.