Close writer after use in ExtractCommandTests
Update `ExtractCommandTests` so that the writer is closed after the contents have been written. See gh-22993
This commit is contained in:
@@ -100,9 +100,9 @@ class ExtractCommandTests {
|
||||
@Test
|
||||
void runWithJarFileContainingNoEntriesFails() throws IOException {
|
||||
File file = new File(this.temp, "empty.jar");
|
||||
FileWriter writer = new FileWriter(file);
|
||||
writer.write("text");
|
||||
writer.flush();
|
||||
try (FileWriter writer = new FileWriter(file)) {
|
||||
writer.write("text");
|
||||
}
|
||||
given(this.context.getJarFile()).willReturn(file);
|
||||
given(this.context.getWorkingDir()).willReturn(this.extract);
|
||||
assertThatIllegalStateException()
|
||||
|
||||
Reference in New Issue
Block a user