1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-26 22:12:05 +01:00

Added more cases to #testEscapeForXML.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2485 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Gaston Dombiak 2005-04-15 00:56:37 +00:00 committed by gaston
parent 0f8bb65755
commit 9caf660bc0

View file

@ -65,22 +65,34 @@ public class StringUtilsTest extends TestCase {
assertNull(StringUtils.escapeForXML(null)); assertNull(StringUtils.escapeForXML(null));
input = "<b>"; input = "<b>";
assertEquals(StringUtils.escapeForXML(input), "&lt;b&gt;"); assertEquals("&lt;b&gt;", StringUtils.escapeForXML(input));
input = "\""; input = "\"";
assertEquals(StringUtils.escapeForXML(input), "&quot;"); assertEquals("&quot;", StringUtils.escapeForXML(input));
input = "&"; input = "&";
assertEquals(StringUtils.escapeForXML(input), "&amp;"); assertEquals("&amp;", StringUtils.escapeForXML(input));
input = "<b>\n\t\r</b>"; input = "<b>\n\t\r</b>";
assertEquals(StringUtils.escapeForXML(input), "&lt;b&gt;\n\t\r&lt;/b&gt;"); assertEquals("&lt;b&gt;\n\t\r&lt;/b&gt;", StringUtils.escapeForXML(input));
input = " & "; input = " & ";
assertEquals(StringUtils.escapeForXML(input), " &amp; "); assertEquals(" &amp; ", StringUtils.escapeForXML(input));
input = " \" "; input = " \" ";
assertEquals(StringUtils.escapeForXML(input), " &quot; "); assertEquals(" &quot; ", StringUtils.escapeForXML(input));
input = "> of me <";
assertEquals("&gt; of me &lt;", StringUtils.escapeForXML(input));
input = "> of me & you<";
assertEquals("&gt; of me &amp; you&lt;", StringUtils.escapeForXML(input));
input = "& <";
assertEquals("&amp; &lt;", StringUtils.escapeForXML(input));
input = "&";
assertEquals("&amp;", StringUtils.escapeForXML(input));
} }
public void testHash() { public void testHash() {