commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Fwd: [lang] remove commons-io test dependency
Date Tue, 20 Dec 2016 14:15:00 GMT
Why make the test code more verbose than it has to be?

Gary
---------- Forwarded message ----------
From: <pascalschumacher@apache.org>
Date: Tue, Dec 20, 2016 at 1:01 AM
Subject: [lang] remove commons-io test dependency
To: commits@commons.apache.org


Repository: commons-lang
Updated Branches:
  refs/heads/master c63653983 -> 7cf5e01c2


remove commons-io test dependency


Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/7cf5e01c
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/7cf5e01c
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/7cf5e01c

Branch: refs/heads/master
Commit: 7cf5e01c2a152a0b612cb19e02213879a57c14d2
Parents: c636539
Author: pascalschumacher <pascalschumacher@gmx.net>
Authored: Tue Dec 20 10:01:04 2016 +0100
Committer: pascalschumacher <pascalschumacher@gmx.net>
Committed: Tue Dec 20 10:01:04 2016 +0100

----------------------------------------------------------------------
 pom.xml                                                   |  7 -------
 .../org/apache/commons/lang3/StringEscapeUtilsTest.java   | 10 +++++-----
 2 files changed, 5 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-lang/blob/7cf5e01c/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 12354b0..0d06563 100644
--- a/pom.xml
+++ b/pom.xml
@@ -520,13 +520,6 @@
     </dependency>

     <dependency>
-      <groupId>commons-io</groupId>
-      <artifactId>commons-io</artifactId>
-      <version>2.5</version>
-      <scope>test</scope>
-    </dependency>
-
-    <dependency>
       <groupId>org.apache.bcel</groupId>
       <artifactId>bcel</artifactId>
       <version>6.0</version>

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/
7cf5e01c/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
b/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
index 28be437..815dc96 100644
--- a/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
@@ -22,14 +22,15 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;

-import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.StringWriter;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Modifier;
 import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Paths;

-import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.text.translate.CharSequenceTranslator;
 import org.apache.commons.lang3.text.translate.NumericEntityEscaper;
 import org.junit.Test;
@@ -555,14 +556,13 @@ public class StringEscapeUtilsTest {
      */
     @Test
     public void testLang708() throws IOException {
-        final FileInputStream fis = new FileInputStream("src/test/
resources/lang-708-input.txt");
-        final String input = IOUtils.toString(fis, "UTF-8");
+        final byte[] inputBytes = Files.readAllBytes(Paths.get("
src/test/resources/lang-708-input.txt"));
+        final String input = new String(inputBytes,
StandardCharsets.UTF_8);
         final String escaped = StringEscapeUtils.escapeEcmaScript(input);
         // just the end:
         assertTrue(escaped, escaped.endsWith("}]"));
         // a little more:
         assertTrue(escaped, escaped.endsWith("\"valueCode\
\\":\\\"\\\"}]"));
-        fis.close();
     }

     /**




-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<https://www.amazon.com/gp/product/1617290459/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&linkCode=as2&tag=garygregory-20&linkId=cadb800f39946ec62ea2b1af9fe6a2b8>

<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1617290459>
JUnit in Action, Second Edition
<https://www.amazon.com/gp/product/1935182021/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&linkCode=as2&tag=garygregory-20&linkId=31ecd1f6b6d1eaf8886ac902a24de418%22>

<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182021>
Spring Batch in Action
<https://www.amazon.com/gp/product/1935182951/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%7Blink_id%7D%7D%22%3ESpring+Batch+in+Action>
<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182951>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message