svn commit: r1857625 - /db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/TestProcessing.java

classic Classic list List threaded Threaded
1 message Options
gk
Reply | Threaded
Open this post in threaded view
|

svn commit: r1857625 - /db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/TestProcessing.java

gk
Author: gk
Date: Tue Apr 16 07:49:02 2019
New Revision: 1857625

URL: http://svn.apache.org/viewvc?rev=1857625&view=rev
Log:
- ignore eol

Modified:
    db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/TestProcessing.java

Modified: db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/TestProcessing.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/TestProcessing.java?rev=1857625&r1=1857624&r2=1857625&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/TestProcessing.java (original)
+++ db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/TestProcessing.java Tue Apr 16 07:49:02 2019
@@ -21,9 +21,15 @@ package org.apache.torque.templates;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -31,6 +37,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.commons.io.Charsets;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.IOUtils;
 import org.apache.torque.generator.configuration.UnitDescriptor;
@@ -366,9 +373,10 @@ public class TestProcessing
             final String actualFilename)
                     throws IOException
     {
+        Charset charset = StandardCharsets.ISO_8859_1;
         String expected = IOUtils.toString(
                 getClass().getResourceAsStream(expectedFilename),
-                "ISO-8859-1");
+                charset);
         // remove license header
         int licenseHeaderEnd = expected.lastIndexOf("##\n");
         if (licenseHeaderEnd != -1)
@@ -380,9 +388,14 @@ public class TestProcessing
             expected = expected.substring(expected.lastIndexOf("##\r\n") + 4);
         }
 
-        final String actual = FileUtils.readFileToString(
-                new File(actualFilename),
-                "iso-8859-1");
-        assertEquals(expected, actual);
+//        final String actual = FileUtils.readFileToString(
+//                new File(actualFilename),
+//                charset);
+        // auto close file input stream
+        try (Reader actualReader  =new InputStreamReader(new FileInputStream(actualFilename), charset) ) {
+            assertTrue(
+                IOUtils.contentEqualsIgnoreEOL(new InputStreamReader(IOUtils.toInputStream(expected, charset)),
+                        actualReader) );
+        }
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]