commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r1148162 - /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
Date Tue, 19 Jul 2011 04:58:03 GMT
Author: bayard
Date: Tue Jul 19 04:58:03 2011
New Revision: 1148162

URL: http://svn.apache.org/viewvc?rev=1148162&view=rev
Log:
Updating unit test for LANG-728 to work with Lang 3.0 way of using escapeXml with > 0x7f
characters

Modified:
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java?rev=1148162&r1=1148161&r2=1148162&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
(original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
Tue Jul 19 04:58:03 2011
@@ -31,6 +31,9 @@ import org.apache.commons.io.IOUtils;
 import org.junit.Ignore;
 import org.junit.Test;
 
+import org.apache.commons.lang3.text.translate.CharSequenceTranslator;
+import org.apache.commons.lang3.text.translate.UnicodeEscaper;
+
 /**
  * Unit tests for {@link StringEscapeUtils}.
  *
@@ -333,15 +336,13 @@ public class StringEscapeUtilsTest {
      * @see <a href="http://www.w3.org/International/questions/qa-escapes">Using character
escapes in markup and CSS</a>
      * @see <a href="https://issues.apache.org/jira/browse/LANG-728">LANG-728</a>
      */
-    @Ignore
     @Test
     public void testEscapeXmlSupplementaryCharacters() {
-        // Example from https://issues.apache.org/jira/browse/LANG-728
-        assertEquals("Supplementary character must be represented using a single escape",
"&#144308;",
-                StringEscapeUtils.escapeXml("\uD84C\uDFB4"));
-        // Example from See http://www.w3.org/International/questions/qa-escapes
-        assertEquals("Supplementary character must be represented using a single escape",
"&#x233B4;",
-                StringEscapeUtils.escapeXml("\uD84C;\uDFB4;"));
+        CharSequenceTranslator escapeXml = 
+            StringEscapeUtils.ESCAPE_XML.with( UnicodeEscaper.between(0x7f, Integer.MAX_VALUE)
);
+
+        assertEquals("Supplementary character must be represented using a single escape",
"\u233B4",
+                escapeXml.translate("\uD84C\uDFB4"));
     }
     
     // Tests issue #38569



Mime
View raw message