Skip to content

Commit

Permalink
[IO-811] Files.walk() direct and indirect callers fail to close the
Browse files Browse the repository at this point in the history
returned Stream<Path>

- Release resource in test
  • Loading branch information
garydgregory committed Sep 30, 2023
1 parent 50e7434 commit bec1893
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,16 @@ public void testIsSameFile() {

@Test
public void testLinesPath() {
assertEquals(0, FilesUncheck.lines(FILE_PATH_EMPTY).count());
try (Stream<String> stream = FilesUncheck.lines(FILE_PATH_EMPTY)) {
assertEquals(0, stream.count());
}
}

@Test
public void testLinesPathCharset() {
assertEquals(0, FilesUncheck.lines(FILE_PATH_EMPTY, StandardCharsets.UTF_8).count());
try (Stream<String> stream = FilesUncheck.lines(FILE_PATH_EMPTY, StandardCharsets.UTF_8)) {
assertEquals(0, stream.count());
}
}

@Test
Expand Down

0 comments on commit bec1893

Please sign in to comment.