\r
@Test\r
public void testEscapeForHtml() throws Exception {\r
- String input = "& < > \" \t";\r
- String outputNoChange = "& < > " \t";\r
- String outputChange = "& < > " ";\r
+ String input = "& < > \"";\r
+ String outputNoChange = "& < > "";\r
+ String outputChange = "& < > "";\r
assertEquals(outputNoChange, StringUtils.escapeForHtml(input, false));\r
assertEquals(outputChange, StringUtils.escapeForHtml(input, true));\r
+\r
+ String tabs = "\t";\r
+ int tabSpaces;\r
+ int expectedLength;\r
+ for (int i = 0; i < 50; i++) {\r
+ tabSpaces = 4 - i % 4;\r
+ expectedLength = (i + tabSpaces) * 6; // = 6 chars\r
+ assertEquals(expectedLength, StringUtils.escapeForHtml(tabs, true).length());\r
+ tabs = " " + tabs;\r
+ }\r
}\r
\r
@Test\r