Cleaning out temp files created by test.
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
+import org.openqa.selenium.io.FileHandler;
import org.openqa.selenium.io.Zip;
import org.openqa.selenium.testing.InProject;
import org.openqa.selenium.testing.drivers.Firebug;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;
+import java.util.stream.Stream;
@RunWith(JUnit4.class)
public class FirefoxProfileTest {
@@ -189,7 +191,11 @@ public void shouldConvertItselfIntoAMeaningfulRepresentation() throws IOExceptio
File prefs = new File(dir, "user.js");
assertTrue(prefs.exists());
- assertTrue(Files.lines(prefs.toPath()).anyMatch(s -> s.contains("i.like.cheese")));
+ try (Stream<String> lines = Files.lines(prefs.toPath())) {
+ assertTrue(lines.anyMatch(s -> s.contains("i.like.cheese")));
+ }
+
+ FileHandler.delete(dir);
}
private List<String> readGeneratedProperties(FirefoxProfile profile) throws Exception {
