Skip to content

Commit 475c3c1

Browse files
committed
Fix storeToken failure test
1 parent d771fa9 commit 475c3c1

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

services/signin/src/test/java/software/amazon/awssdk/services/signin/auth/internal/OnDiskTokenManagerTest.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,9 @@ void loadToken_whenCorruptJson_raisesException() throws IOException {
114114

115115
@Test
116116
void storeToken_whenIoFails_raisesException() {
117-
Path readOnlyDir = tempDir.resolve("readonly");
118-
try {
119-
Files.createDirectory(readOnlyDir);
120-
readOnlyDir.toFile().setReadOnly();
121-
} catch (IOException e) {
122-
fail("Unable to set up readonly dir");
123-
}
124-
117+
Path readOnlyDir = tempDir.resolve("pathdoesnotexist");
125118
OnDiskTokenManager manager = OnDiskTokenManager.create(readOnlyDir, LOGIN_SESSION_ID);
126-
assertThrows(SdkClientException.class, () -> manager.storeToken(token));
119+
SdkClientException e = assertThrows(SdkClientException.class, () -> manager.storeToken(token));
127120
}
128121

129122
@Test

0 commit comments

Comments
 (0)