Skip to content

Commit 5187199

Browse files
committed
Catch NoSuchFileException instead of IOException base class in KeyBufferTest.java.
1 parent d6e0051 commit 5187199

File tree

1 file changed

+2
-1
lines changed
  • powertools-logging/src/test/java/software/amazon/lambda/powertools/logging/internal

1 file changed

+2
-1
lines changed

powertools-logging/src/test/java/software/amazon/lambda/powertools/logging/internal/KeyBufferTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.io.IOException;
2222
import java.io.PrintStream;
2323
import java.nio.channels.FileChannel;
24+
import java.nio.file.NoSuchFileException;
2425
import java.nio.file.Paths;
2526
import java.nio.file.StandardOpenOption;
2627
import java.util.Deque;
@@ -44,7 +45,7 @@ void setUp() throws IOException {
4445
// Clean up log file before each test
4546
try {
4647
FileChannel.open(Paths.get("target/logfile.json"), StandardOpenOption.WRITE).truncate(0).close();
47-
} catch (IOException e) {
48+
} catch (NoSuchFileException e) {
4849
// may not be there in the first run
4950
}
5051
}

0 commit comments

Comments
 (0)