KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > wcf > utils > XmlUtilsTest


1 package com.tonbeller.wcf.utils;
2
3 import junit.framework.TestCase;
4
5 public class XmlUtilsTest extends TestCase {
6   public void testEscapeXml() {
7     assertEquals("ab"cd", XmlUtils.escapeXml("ab\"cd"));
8     // no common escape for both, HTML and XML.
9
assertEquals("ab'cd", XmlUtils.escapeXml("ab'cd"));
10     assertEquals("a&b", XmlUtils.escapeXml("a&b"));
11     assertEquals("ab&lt;tag&gt;cd", XmlUtils.escapeXml("ab<tag>cd"));
12     assertEquals(null, XmlUtils.escapeXml(null));
13     assertEquals("", XmlUtils.escapeXml(""));
14   }
15
16 }
17
Popular Tags