From 9caf660bc0205c916ce7faedbb3ca07afd2c3250 Mon Sep 17 00:00:00 2001 From: Gaston Dombiak Date: Fri, 15 Apr 2005 00:56:37 +0000 Subject: [PATCH] Added more cases to #testEscapeForXML. git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2485 b35dd754-fafc-0310-a699-88a17e54d16e --- .../smack/util/StringUtilsTest.java | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/test/org/jivesoftware/smack/util/StringUtilsTest.java b/test/org/jivesoftware/smack/util/StringUtilsTest.java index 64b383176..b3ac230ea 100644 --- a/test/org/jivesoftware/smack/util/StringUtilsTest.java +++ b/test/org/jivesoftware/smack/util/StringUtilsTest.java @@ -65,22 +65,34 @@ public class StringUtilsTest extends TestCase { assertNull(StringUtils.escapeForXML(null)); input = ""; - assertEquals(StringUtils.escapeForXML(input), "<b>"); + assertEquals("<b>", StringUtils.escapeForXML(input)); input = "\""; - assertEquals(StringUtils.escapeForXML(input), """); + assertEquals(""", StringUtils.escapeForXML(input)); input = "&"; - assertEquals(StringUtils.escapeForXML(input), "&"); + assertEquals("&", StringUtils.escapeForXML(input)); input = "\n\t\r"; - assertEquals(StringUtils.escapeForXML(input), "<b>\n\t\r</b>"); + assertEquals("<b>\n\t\r</b>", StringUtils.escapeForXML(input)); input = " & "; - assertEquals(StringUtils.escapeForXML(input), " & "); + assertEquals(" & ", StringUtils.escapeForXML(input)); input = " \" "; - assertEquals(StringUtils.escapeForXML(input), " " "); + assertEquals(" " ", StringUtils.escapeForXML(input)); + + input = "> of me <"; + assertEquals("> of me <", StringUtils.escapeForXML(input)); + + input = "> of me & you<"; + assertEquals("> of me & you<", StringUtils.escapeForXML(input)); + + input = "& <"; + assertEquals("& <", StringUtils.escapeForXML(input)); + + input = "&"; + assertEquals("&", StringUtils.escapeForXML(input)); } public void testHash() {