Display LocalVariables along with Locations in the html report.
[cfb.git] / test / net / jaekl / cfb / util / XmlEscapeTest.java
diff --git a/test/net/jaekl/cfb/util/XmlEscapeTest.java b/test/net/jaekl/cfb/util/XmlEscapeTest.java
new file mode 100644 (file)
index 0000000..f514e95
--- /dev/null
@@ -0,0 +1,53 @@
+package net.jaekl.cfb.util;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class XmlEscapeTest {
+
+       @Test
+       public void test() {
+               String[][] data = {
+                               { null, null },
+                               { "", "" },
+                               { "fred", "fred" },
+                               { "org.example.Foo.<init>()", "org.example.Foo.&lt;init&gt;()" },
+                               {
+                                       "ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ",
+                                       "ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ"
+                               },
+                               {
+                                         "L'amour est enfant de Bohême\n"
+                                       + "Il n'a jamais, jamais connu de loi\n"
+                                       + "Si tu ne m'aimes pas, je t'aime\n"
+                                       + "Si je t'aime, prends garde à toi!\n"
+                                       + "Si tu ne m’aimes pas\n"
+                                       + "Si tu ne m’aimes pas, je t’aime!\n"
+                                       + "Mais, si je t’aime\n"
+                                       + "Si je t’aime, prends garde à toi!",
+                                       
+                                         "L&apos;amour est enfant de Bohême\n"
+                                       + "Il n&apos;a jamais, jamais connu de loi\n"
+                                       + "Si tu ne m&apos;aimes pas, je t&apos;aime\n"
+                                       + "Si je t&apos;aime, prends garde à toi!\n"
+                                       + "Si tu ne m’aimes pas\n"
+                                       + "Si tu ne m’aimes pas, je t’aime!\n"
+                                       + "Mais, si je t’aime\n"
+                                       + "Si je t’aime, prends garde à toi!",
+                               },
+                               {
+                                       "\"I'm sorry Dave,\" said Hal, \"but I can't do that.\"",
+                                       "&quot;I&apos;m sorry Dave,&quot; said Hal, &quot;but I can&apos;t do that.&quot;"
+                               }
+                       };
+               
+               for (String[] datum : data) {
+                       String input = datum[0];
+                       String expected = datum[1];
+                       String actual = XmlEscape.toEscaped(input);
+                       assertEquals(expected, actual);
+               }
+       }
+
+}