From: <wan...@us...> - 2003-07-17 21:13:52
|
Update of /cvsroot/webmacro/webmacro/test/unit/org/webmacro/util In directory sc8-pr-cvs1:/tmp/cvs-serv29507 Added Files: TestHTMLEscaper.java Log Message: New unit tests --- NEW FILE: TestHTMLEscaper.java --- package org.webmacro.util; import junit.framework.TestCase; public class TestHTMLEscaper extends TestCase { public TestHTMLEscaper (String name) { super(name); } protected void setUp () { } public void testEscaping () throws Exception { assertEscape("<B>", "<B>"); assertEscape("\u00f6", "ö"); assertEscape("\u00a9", "©"); assertEscape("\u00a3", "£"); assertEscape("\u0080", "€"); assertEscape("This is a test: \u0080\u0080\u0080 is better than" + "\u00a3\u00a3\u00a3!", "This is a test: €€€ is better than" + "£££!" ); } public void testEscapingNull() throws Exception { assertTrue( "Escaping null didn't return null!", HTMLEscaper.escape( null) == null); } private void assertEscape( String text, String expected ) { String res = HTMLEscaper.escape(text); if (!res.equals(expected)) { String s = "Escaped /" + text + "/ and expected /" + expected + "/ but got /" + res+"/"; assertTrue( s, false); } } } |