Skip to content

Commit 82f045e

Browse files
committed
Updated tests, do not explicitly swallow exceptions
1 parent 9db71b4 commit 82f045e

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

core/auth/src/test/java/software/amazon/awssdk/auth/token/credentials/ProfileTokenProviderTest.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,9 @@ void resolveToken_profileFileSupplier_suppliesObjectPerCall() {
8989
ProfileTokenProvider provider =
9090
ProfileTokenProvider.builder().profileFile(supplier).profileName("sso").build();
9191

92-
try {
93-
Mockito.when(supplier.get()).thenReturn(file1);
94-
provider.resolveToken();
95-
} catch (IllegalArgumentException e) {
96-
}
97-
98-
try {
99-
Mockito.when(supplier.get()).thenReturn(file2);
100-
provider.resolveToken();
101-
} catch (IllegalArgumentException e) {
102-
}
92+
Mockito.when(supplier.get()).thenReturn(file1, file2);
93+
assertThatThrownBy(provider::resolveToken).isInstanceOf(IllegalArgumentException.class);
94+
assertThatThrownBy(provider::resolveToken).isInstanceOf(IllegalArgumentException.class);
10395

10496
Mockito.verify(supplier, Mockito.times(2)).get();
10597
}

0 commit comments

Comments
 (0)