From 5b09ae527551228177ea62fa2b8b75859b2de262 Mon Sep 17 00:00:00 2001 From: Sunil Gulabani Date: Tue, 11 Oct 2016 14:14:11 +0530 Subject: [PATCH] Added stream close snippet --- .../src/test/java/com/baeldung/file/FileOperationsTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-8/src/test/java/com/baeldung/file/FileOperationsTest.java b/core-java-8/src/test/java/com/baeldung/file/FileOperationsTest.java index 3752fc5b7f..90f5ded1cb 100644 --- a/core-java-8/src/test/java/com/baeldung/file/FileOperationsTest.java +++ b/core-java-8/src/test/java/com/baeldung/file/FileOperationsTest.java @@ -102,6 +102,7 @@ public class FileOperationsTest { StringBuilder data = new StringBuilder(); Stream lines = Files.lines(path); lines.forEach(line -> data.append(line).append("\n")); + lines.close(); Assert.assertEquals(expectedData, data.toString().trim()); }