You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by gk...@apache.org on 2019/04/16 07:49:03 UTC
svn commit: r1857625 -
/db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/TestProcessing.java
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: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org