From 7cf5e01c2a152a0b612cb19e02213879a57c14d2 Mon Sep 17 00:00:00 2001 From: pascalschumacher Date: Tue, 20 Dec 2016 10:01:04 +0100 Subject: [PATCH] remove commons-io test dependency --- pom.xml | 7 ------- .../apache/commons/lang3/StringEscapeUtilsTest.java | 10 +++++----- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/pom.xml b/pom.xml index 12354b070..0d06563bb 100644 --- a/pom.xml +++ b/pom.xml @@ -519,13 +519,6 @@ test - - commons-io - commons-io - 2.5 - test - - org.apache.bcel bcel diff --git a/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java b/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java index 28be43771..815dc966f 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(); } /**