Skip to content

Commit

Permalink
AWS: Rename test helper to deconflict with Assertions (apache#10511)
Browse files Browse the repository at this point in the history
The test helper `assertThatThrownBy` had same name like
`Assertions.assertThatThrownBy` but different API (not assertion
builder). Rename to avoid confusion.
  • Loading branch information
findepi authored Jun 17, 2024
1 parent 5f3809c commit 87810c8
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,15 @@ private void testProviderAndAssertThrownBy(String providerClassName, String cont
public void assertAllClientObjectsThrownBy(
AwsClientFactory defaultAwsClientFactory, String containsMessage) {
// invoking sdk client apis to ensure resolveCredentials() being called
assertThatThrownBy(() -> defaultAwsClientFactory.s3().listBuckets(), containsMessage);
assertThatThrownBy(
assertIllegalArgumentException(
() -> defaultAwsClientFactory.s3().listBuckets(), containsMessage);
assertIllegalArgumentException(
() -> defaultAwsClientFactory.glue().getTables(GetTablesRequest.builder().build()),
containsMessage);
assertThatThrownBy(() -> defaultAwsClientFactory.dynamo().listTables(), containsMessage);
assertThatThrownBy(() -> defaultAwsClientFactory.kms().listAliases(), containsMessage);
assertIllegalArgumentException(
() -> defaultAwsClientFactory.dynamo().listTables(), containsMessage);
assertIllegalArgumentException(
() -> defaultAwsClientFactory.kms().listAliases(), containsMessage);
}

private void assertClientObjectsNotNull(AwsClientFactory defaultAwsClientFactory) {
Expand All @@ -210,7 +213,7 @@ private void assertClientObjectsNotNull(AwsClientFactory defaultAwsClientFactory
Assertions.assertThat(defaultAwsClientFactory.kms()).isNotNull();
}

private void assertThatThrownBy(
private void assertIllegalArgumentException(
ThrowableAssert.ThrowingCallable shouldRaiseThrowable, String containsMessage) {
Assertions.assertThatThrownBy(shouldRaiseThrowable)
.isInstanceOf(IllegalArgumentException.class)
Expand Down

0 comments on commit 87810c8

Please sign in to comment.