OSDN Git Service

Merge develop into pomconfig
[mikutoga/TogaGem.git] / src / test / java / jp / sfjp / mikutoga / xml / BasicXmlExporterTest.java
index 61edcc4..30781e2 100644 (file)
@@ -36,6 +36,78 @@ public class BasicXmlExporterTest {
     }
 
     /**
     }
 
     /**
+     * Test of putCharRef2Hex method, of class BasicXmlExporter.
+     * @throws IOException
+     */
+    @Test
+    public void testPutCharRef2Hex() throws IOException{
+        System.out.println("putCharRef2Hex");
+
+        BasicXmlExporter instance;
+        StringBuffer buf;
+
+        instance = new BasicXmlExporter();
+
+        buf = new StringBuffer();
+        instance.setAppendable(buf);
+        instance.putCharRef2Hex('\u0000');
+        assertEquals("�", buf.toString());
+
+        buf = new StringBuffer();
+        instance.setAppendable(buf);
+        instance.putCharRef2Hex('A');
+        assertEquals("A", buf.toString());
+
+        buf = new StringBuffer();
+        instance.setAppendable(buf);
+        instance.putCharRef2Hex('\u00ff');
+        assertEquals("ÿ", buf.toString());
+
+        buf = new StringBuffer();
+        instance.setAppendable(buf);
+        instance.putCharRef2Hex('\u0100');
+        assertEquals("Ā", buf.toString());
+
+        return;
+    }
+
+    /**
+     * Test of putCh method, of class BasicXmlExporter.
+     * @throws IOException
+     */
+    @Test
+    public void testPutCh() throws IOException{
+        System.out.println("putCh");
+
+        BasicXmlExporter instance;
+        StringBuffer buf;
+
+        instance = new BasicXmlExporter();
+
+        buf = new StringBuffer();
+        instance.setAppendable(buf);
+        instance.putCh('A');
+        assertEquals("A", buf.toString());
+
+        buf = new StringBuffer();
+        instance.setAppendable(buf);
+        instance.putCh('B').putCh('7').putCh('あ');
+        assertEquals("B7あ", buf.toString());
+
+        buf = new StringBuffer();
+        instance.setAppendable(buf);
+        instance.putCh('&').putCh('<').putCh('>').putCh('"').putCh('\'');
+        assertEquals("&amp;&lt;&gt;&quot;&apos;", buf.toString());
+
+        buf = new StringBuffer();
+        instance.setAppendable(buf);
+        instance.putCh('\b');
+        assertEquals("&#x08;", buf.toString());
+
+        return;
+    }
+
+    /**
      * Test of append method, of class BasicXmlExporter.
      */
     @Test
      * Test of append method, of class BasicXmlExporter.
      */
     @Test