@Test public void testSameNames() { String s; s = HtmlDecoder.decode("á"); assertEquals(1, s.length()); assertEquals(0xE1, s.charAt(0)); s = HtmlDecoder.decode("Á"); assertEquals(1, s.length()); assertEquals(0xC1, s.charAt(0)); }
@Test public void testHexDecimal() { String s; s = HtmlDecoder.decode("ÿ"); assertEquals(1, s.length()); assertEquals(0xFF, s.charAt(0)); s = HtmlDecoder.decode("ÿ"); assertEquals(5, s.length()); assertEquals("ÿ", s); s = HtmlDecoder.decode("&#"); assertEquals("&#", s); s = HtmlDecoder.decode("&"); assertEquals("&", s); s = HtmlDecoder.decode("{"); assertEquals("{", s); s = HtmlDecoder.decode("{"); assertEquals(1, s.length()); assertEquals(123, s.charAt(0)); s = HtmlDecoder.decode("aaa AA aaa"); assertEquals("aaa AA aaa", s); }
@Test public void testDecodeNotFound() { String s = "switchTab("Senthil1");showWorkFlow("/xyz/abc.jsp?strWorkId=1691&archived=0");"; String out = HtmlDecoder.decode(s); assertEquals( "switchTab(\"Senthil1\");showWorkFlow(\"/xyz/abc.jsp?strWorkId=1691&archived=0\");", out); }
@Test public void testEntities() { String s; s = HtmlDecoder.decode("&"); assertEquals("&", s); s = HtmlDecoder.decode("&"); assertEquals("&", s); s = HtmlDecoder.decode("&"); assertEquals("&", s); s = HtmlDecoder.decode("2 < 5"); assertEquals("2 < 5", s); s = HtmlDecoder.decode("á"); assertEquals(1, s.length()); assertEquals(0xe1, s.charAt(0)); }