[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [collector/master] Become Java 7 compliant again.



commit 90f074af25f7f21a5cec699a65467b51622ebbde
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Wed Oct 26 09:27:45 2016 +0200

    Become Java 7 compliant again.
---
 .../torproject/collector/persist/PersistUtilsTest.java   | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/test/java/org/torproject/collector/persist/PersistUtilsTest.java b/src/test/java/org/torproject/collector/persist/PersistUtilsTest.java
index 0fcfe14..50ace87 100644
--- a/src/test/java/org/torproject/collector/persist/PersistUtilsTest.java
+++ b/src/test/java/org/torproject/collector/persist/PersistUtilsTest.java
@@ -11,6 +11,7 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
 
+import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -36,7 +37,7 @@ public class PersistUtilsTest {
     assertFalse("Files shouldn't be created.",
         PersistenceUtils.storeToFileSystem(ANNO1.getBytes(),
         "some text".getBytes(), out, StandardOpenOption.CREATE_NEW, true));
-    List<String> text = Files.readAllLines(out);
+    List<String> text = Files.readAllLines(out, StandardCharsets.UTF_8);
     assertTrue("List should be empty: " + text, text.isEmpty());
   }
 
@@ -48,7 +49,8 @@ public class PersistUtilsTest {
     assertTrue("Files should be created.",
         PersistenceUtils.storeToFileSystem(ANNO1.getBytes(),
         (theText + "\n").getBytes(), pathToCreate, StandardOpenOption.CREATE));
-    List<String> text = Files.readAllLines(pathToCreate);
+    List<String> text = Files.readAllLines(pathToCreate,
+        StandardCharsets.UTF_8);
     assertEquals("File contained: " + text, 2, text.size());
     assertEquals("File contained: " + text, theText, text.get(1));
   }
@@ -61,7 +63,8 @@ public class PersistUtilsTest {
     assertTrue("Files should be created.",
         PersistenceUtils.storeToFileSystem(ANNO1.getBytes(),
         (theText + "\n").getBytes(), pathToCreate, StandardOpenOption.CREATE));
-    List<String> text = Files.readAllLines(pathToCreate);
+    List<String> text = Files.readAllLines(pathToCreate,
+        StandardCharsets.UTF_8);
     assertEquals("File contained: " + text, 2, text.size());
     assertEquals("File contained: " + text, theText, text.get(1));
     String theText2 = "other symbols";
@@ -69,7 +72,7 @@ public class PersistUtilsTest {
         PersistenceUtils.storeToFileSystem((ANNO2).getBytes(),
         (theText2 + "\n").getBytes(), pathToCreate,
         StandardOpenOption.TRUNCATE_EXISTING));
-    text = Files.readAllLines(pathToCreate);
+    text = Files.readAllLines(pathToCreate, StandardCharsets.UTF_8);
     assertEquals("File contained: " + text, 2, text.size());
     assertEquals("File contained: " + text, "2@annotation", text.get(0));
     assertEquals("File contained: " + text, theText2, text.get(1));
@@ -83,14 +86,15 @@ public class PersistUtilsTest {
     assertTrue("Files should be created.",
         PersistenceUtils.storeToFileSystem(ANNO1.getBytes(),
         (theText + "\n").getBytes(), pathToCreate, StandardOpenOption.CREATE));
-    List<String> text = Files.readAllLines(pathToCreate);
+    List<String> text = Files.readAllLines(pathToCreate,
+        StandardCharsets.UTF_8);
     assertEquals("File contained: " + text, 2, text.size());
     assertEquals("File contained: " + text, theText, text.get(1));
     String theText2 = "other symbols";
     assertTrue("Files should be created.",
         PersistenceUtils.storeToFileSystem((ANNO2).getBytes(),
         (theText2 + "\n").getBytes(), pathToCreate, StandardOpenOption.APPEND));
-    text = Files.readAllLines(pathToCreate);
+    text = Files.readAllLines(pathToCreate, StandardCharsets.UTF_8);
     assertEquals("File contained: " + text, 4, text.size());
     assertEquals("File contained: " + text, "1@annotation", text.get(0));
     assertEquals("File contained: " + text, theText, text.get(1));

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits