OSDN Git Service

Merge commit '2234b50cfbe7c86237086a3bf4e62397814a390e'
[jindolf/JinParser.git] / src / test / java / jp / sourceforge / jindolf / parser / DecodedContentTest.java
index 69559ce..096dc29 100644 (file)
-/*\r
- * Copyright(c) 2009 olyutorskii\r
- * $Id: DecodedContentTest.java 894 2009-11-04 07:26:59Z olyutorskii $\r
- */\r
-\r
-package jp.sourceforge.jindolf.parser;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-import org.junit.After;\r
-import org.junit.AfterClass;\r
-import org.junit.Before;\r
-import org.junit.BeforeClass;\r
-import org.junit.Test;\r
-import static org.junit.Assert.*;\r
-\r
-/**\r
- */\r
-public class DecodedContentTest {\r
-\r
-    public DecodedContentTest() {\r
-    }\r
-\r
-    @BeforeClass\r
-    public static void setUpClass() throws Exception{\r
-    }\r
-\r
-    @AfterClass\r
-    public static void tearDownClass() throws Exception{\r
-    }\r
-\r
-    @Before\r
-    public void setUp() {\r
-    }\r
-\r
-    @After\r
-    public void tearDown() {\r
-    }\r
-\r
-    /**\r
-     * Test of Constructor, of class DecodedContent.\r
-     */\r
-    @Test\r
-    public void testConstructor(){\r
-        System.out.println("Constructor");\r
-\r
-        DecodedContent content;\r
-\r
-        content = new DecodedContent();\r
-        assertEquals("", content.toString());\r
-\r
-        content = new DecodedContent("abc");\r
-        assertEquals("abc", content.toString());\r
-\r
-        content = new DecodedContent(128);\r
-        assertEquals("", content.toString());\r
-\r
-        content = new DecodedContent(0);\r
-        assertEquals("", content.toString());\r
-        content.append("abc");\r
-        assertEquals("abc", content.toString());\r
-\r
-        try{\r
-            content = new DecodedContent(-1);\r
-            fail();\r
-        }catch(NegativeArraySizeException e){\r
-        }catch(Throwable e){\r
-            fail();\r
-        }\r
-\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * Test of init method, of class DecodedContent.\r
-     */\r
-    @Test\r
-    public void testInit(){\r
-        System.out.println("init");\r
-\r
-        DecodedContent content;\r
-\r
-        content = new DecodedContent();\r
-        content.append("abc");\r
-        content.addDecodeError((byte)0xff);\r
-        content.append("def");\r
-        assertEquals("abc?def", content.toString());\r
-        assertEquals(1, content.getDecodeErrorList().size());\r
-\r
-        content.init();\r
-        assertEquals("", content.toString());\r
-        assertEquals(0, content.getDecodeErrorList().size());\r
-\r
-        content.append('X');\r
-        assertEquals("X", content.toString());\r
-\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * Test of hasDecodeError method, of class DecodedContent.\r
-     */\r
-    @Test\r
-    public void testHasDecodeError(){\r
-        System.out.println("hasDecodeError");\r
-\r
-        DecodedContent content;\r
-\r
-        content = new DecodedContent();\r
-        assertFalse(content.hasDecodeError());\r
-\r
-        content.append("a");\r
-        assertFalse(content.hasDecodeError());\r
-\r
-        content.addDecodeError((byte)0xff);\r
-        assertTrue(content.hasDecodeError());\r
-\r
-        content.append("b");\r
-        assertTrue(content.hasDecodeError());\r
-\r
-        content.init();\r
-        assertFalse(content.hasDecodeError());\r
-\r
-        content.append("c");\r
-        assertFalse(content.hasDecodeError());\r
-\r
-        content = new DecodedContent();\r
-        List list = content.getDecodeErrorList();\r
-        assertEquals(0, list.size());\r
-        assertFalse(content.hasDecodeError());\r
-\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * Test of getDecodeErrorList method, of class DecodedContent.\r
-     */\r
-    @Test\r
-    public void testGetDecodeErrorList(){\r
-        System.out.println("getDecodeErrorList");\r
-\r
-        DecodedContent content;\r
-        List<DecodeErrorInfo> list;\r
-\r
-        content = new DecodedContent();\r
-        list = content.getDecodeErrorList();\r
-        assertEquals(0, list.size());\r
-\r
-        content.append("abc");\r
-        list = content.getDecodeErrorList();\r
-        assertEquals(0, list.size());\r
-\r
-        content.addDecodeError((byte)0xff);\r
-        list = content.getDecodeErrorList();\r
-        assertEquals(1, list.size());\r
-\r
-        content.append("def");\r
-        list = content.getDecodeErrorList();\r
-        assertEquals(1, list.size());\r
-\r
-        content.addDecodeError((byte)0x03, (byte)0x04);\r
-        list = content.getDecodeErrorList();\r
-        assertEquals(2, list.size());\r
-\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * Test of getRawContent method, of class DecodedContent.\r
-     */\r
-    @Test\r
-    public void testGetRawContent(){\r
-        System.out.println("getRawContent");\r
-\r
-        DecodedContent content;\r
-\r
-        content = new DecodedContent();\r
-        assertEquals("", content.getRawContent().toString());\r
-\r
-        content.append("a");\r
-        assertEquals("a", content.getRawContent().toString());\r
-\r
-        content.addDecodeError((byte)0xff);\r
-        assertEquals("a?", content.getRawContent().toString());\r
-\r
-        content.append("b");\r
-        assertEquals("a?b", content.getRawContent().toString());\r
-\r
-        assertEquals(content.toString(), content.getRawContent().toString());\r
-\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * Test of charAt method, of class DecodedContent.\r
-     */\r
-    @Test\r
-    public void testCharAt(){\r
-        System.out.println("charAt");\r
-\r
-        DecodedContent content;\r
-\r
-        content = new DecodedContent();\r
-        content.append("12345");\r
-        assertEquals('1', content.charAt(0));\r
-        assertEquals('3', content.charAt(2));\r
-        assertEquals('5', content.charAt(4));\r
-\r
-        try{\r
-            content.charAt(-1);\r
-            fail();\r
-        }catch(IndexOutOfBoundsException e){\r
-        }catch(Throwable e){\r
-            fail();\r
-        }\r
-\r
-        try{\r
-            content.charAt(5);\r
-            fail();\r
-        }catch(IndexOutOfBoundsException e){\r
-        }catch(Throwable e){\r
-            fail();\r
-        }\r
-\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * Test of length method, of class DecodedContent.\r
-     */\r
-    @Test\r
-    public void testLength(){\r
-        System.out.println("length");\r
-\r
-        DecodedContent content;\r
-\r
-        content = new DecodedContent();\r
-        assertEquals(0, content.length());\r
-\r
-        content.append("12345");\r
-        assertEquals(5, content.length());\r
-\r
-        content.addDecodeError((byte)0xff);\r
-        assertEquals(6, content.length());\r
-\r
-        content.init();\r
-        assertEquals(0, content.length());\r
-\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * Test of subSequence method, of class DecodedContent.\r
-     */\r
-    @Test\r
-    public void testSubSequence(){\r
-        System.out.println("subSequence");\r
-\r
-        DecodedContent content;\r
-\r
-        content = new DecodedContent();\r
-\r
-        content.append("12345");\r
-        assertEquals("234", content.subSequence(1, 4).toString());\r
-\r
-        try{\r
-            content.subSequence(-1, 4);\r
-            fail();\r
-        }catch(IndexOutOfBoundsException e){\r
-        }catch(Throwable e){\r
-            fail();\r
-        }\r
-\r
-        try{\r
-            content.subSequence(1, 6);\r
-            fail();\r
-        }catch(IndexOutOfBoundsException e){\r
-        }catch(Throwable e){\r
-            fail();\r
-        }\r
-\r
-        try{\r
-            content.subSequence(4, 1);\r
-            fail();\r
-        }catch(IndexOutOfBoundsException e){\r
-        }catch(Throwable e){\r
-            fail();\r
-        }\r
-\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * Test of subContent method, of class DecodedContent.\r
-     */\r
-    @Test\r
-    public void testSubContent(){\r
-        System.out.println("subContent");\r
-\r
-        DecodedContent content;\r
-\r
-        content = new DecodedContent();\r
-\r
-        content.append("12345");\r
-        assertEquals("234", content.subContent(1, 4).toString());\r
-\r
-        try{\r
-            content.subContent(-1, 4);\r
-            fail();\r
-        }catch(IndexOutOfBoundsException e){\r
-        }catch(Throwable e){\r
-            fail();\r
-        }\r
-\r
-        try{\r
-            content.subContent(1, 6);\r
-            fail();\r
-        }catch(IndexOutOfBoundsException e){\r
-        }catch(Throwable e){\r
-            fail();\r
-        }\r
-\r
-        try{\r
-            content.subContent(4, 1);\r
-            fail();\r
-        }catch(IndexOutOfBoundsException e){\r
-        }catch(Throwable e){\r
-            fail();\r
-        }\r
-\r
-        content = new DecodedContent();\r
-        content.append("ab");\r
-        content.addDecodeError((byte)0x01);\r
-        content.append("de");\r
-        content = content.subContent(1,4);\r
-        assertEquals("b?d", content.toString());\r
-\r
-        List<DecodeErrorInfo> list = content.getDecodeErrorList();\r
-        assertEquals(1, list.size());\r
-        assertEquals((byte)0x01, list.get(0).getRawByte1st());\r
-\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * Test of append method, of class DecodedContent.\r
-     */\r
-    @Test\r
-    public void testAppend_char(){\r
-        System.out.println("append");\r
-\r
-        DecodedContent content;\r
-\r
-        content = new DecodedContent();\r
-        content.append('a');\r
-        assertEquals("a", content.toString());\r
-\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * Test of append method, of class DecodedContent.\r
-     */\r
-    @Test\r
-    public void testAppend_CharSequence(){\r
-        System.out.println("append");\r
-\r
-        DecodedContent content;\r
-\r
-        content = new DecodedContent();\r
-        CharSequence seq = "abc";\r
-        content.append(seq);\r
-        assertEquals("abc", content.toString());\r
-\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * Test of append method, of class DecodedContent.\r
-     */\r
-    @Test\r
-    public void testAppend_3args_1(){\r
-        System.out.println("append");\r
-\r
-        DecodedContent content;\r
-\r
-        content = new DecodedContent();\r
-        content.append("abc");\r
-        assertEquals("abc", content.toString());\r
-\r
-        CharSequence seq = "12345";\r
-        content.append(seq, 1, 4);\r
-        assertEquals("abc234", content.toString());\r
-\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * Test of append method, of class DecodedContent.\r
-     */\r
-    @Test\r
-    public void testAppend_3args_2(){\r
-        System.out.println("append");\r
-\r
-        DecodedContent content;\r
-\r
-        content = new DecodedContent();\r
-        content.append("abc");\r
-\r
-        DecodedContent other;\r
-        other = new DecodedContent();\r
-        other.append("12345");\r
-\r
-        content.append(other, 1, 4);\r
-        assertEquals("abc234", content.toString());\r
-\r
-        content = new DecodedContent();\r
-        content.append("abc");\r
-\r
-        other = new DecodedContent();\r
-        other.addDecodeError((byte)0x01);\r
-        other.addDecodeError((byte)0x02);\r
-        other.addDecodeError((byte)0x03);\r
-        other.addDecodeError((byte)0x04);\r
-        other.addDecodeError((byte)0x05);\r
-\r
-        content.append(other, 1, 4);\r
-        assertEquals("abc???", content.toString());\r
-\r
-        List<DecodeErrorInfo> list = content.getDecodeErrorList();\r
-        assertEquals(3, list.size());\r
-\r
-        DecodeErrorInfo info;\r
-\r
-        info = list.get(0);\r
-        assertEquals(3, info.getCharPosition());\r
-        assertEquals((byte)0x02, info.getRawByte1st());\r
-        info = list.get(1);\r
-        assertEquals(4, info.getCharPosition());\r
-        assertEquals((byte)0x03, info.getRawByte1st());\r
-        info = list.get(2);\r
-        assertEquals(5, info.getCharPosition());\r
-        assertEquals((byte)0x04, info.getRawByte1st());\r
-\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * Test of addDecodeError method, of class DecodedContent.\r
-     */\r
-    @Test\r
-    public void testAddDecodeError_byte(){\r
-        System.out.println("addDecodeError");\r
-\r
-        DecodedContent content;\r
-\r
-        content = new DecodedContent();\r
-        content.append("abc");\r
-        content.addDecodeError((byte)0xfe);\r
-        content.append("def");\r
-        content.addDecodeError((byte)0xff);\r
-\r
-        assertEquals("abc?def?", content.toString());\r
-        List<DecodeErrorInfo> list = content.getDecodeErrorList();\r
-        assertEquals(2, list.size());\r
-\r
-        DecodeErrorInfo info;\r
-\r
-        info = list.get(0);\r
-        assertEquals(3, list.get(0).getCharPosition());\r
-        assertFalse(info.has2nd());\r
-        assertEquals((byte)0xfe, info.getRawByte1st());\r
-\r
-        info = list.get(1);\r
-        assertEquals(7, info.getCharPosition());\r
-        assertFalse(info.has2nd());\r
-        assertEquals((byte)0xff, info.getRawByte1st());\r
-\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * Test of addDecodeError method, of class DecodedContent.\r
-     */\r
-    @Test\r
-    public void testAddDecodeError_byte_byte(){\r
-        System.out.println("addDecodeError");\r
-\r
-        DecodedContent content;\r
-\r
-        content = new DecodedContent();\r
-        content.append("abc");\r
-        content.addDecodeError((byte)0x01, (byte)0x02);\r
-        content.append("def");\r
-        content.addDecodeError((byte)0xfe, (byte)0xff);\r
-\r
-        assertEquals("abc?def?", content.toString());\r
-        List<DecodeErrorInfo> list = content.getDecodeErrorList();\r
-        assertEquals(2, list.size());\r
-\r
-        DecodeErrorInfo info;\r
-\r
-        info = list.get(0);\r
-        assertEquals(3, list.get(0).getCharPosition());\r
-        assertTrue(info.has2nd());\r
-        assertEquals((byte)0x01, info.getRawByte1st());\r
-        assertEquals((byte)0x02, info.getRawByte2nd());\r
-\r
-        info = list.get(1);\r
-        assertEquals(7, info.getCharPosition());\r
-        assertTrue(info.has2nd());\r
-        assertEquals((byte)0xfe, info.getRawByte1st());\r
-        assertEquals((byte)0xff, info.getRawByte2nd());\r
-\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * Test of toString method, of class DecodedContent.\r
-     */\r
-    @Test\r
-    public void testToString(){\r
-        System.out.println("toString");\r
-\r
-        DecodedContent content;\r
-\r
-        content = new DecodedContent();\r
-        content.append("abc");\r
-        content.addDecodeError((byte)0x01, (byte)0x02);\r
-        content.append("def");\r
-        content.addDecodeError((byte)0xfe, (byte)0xff);\r
-\r
-        assertEquals("abc?def?", content.toString());\r
-        assertEquals(content.getRawContent().toString(), content.toString());\r
-\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * Test of lsearchErrorIndex method, of class DecodedContent.\r
-     */\r
-    @Test\r
-    public void testLsearchErrorIndex(){\r
-        System.out.println("lsearchErrorIndex");\r
-\r
-        List<DecodeErrorInfo> errList;\r
-        int result;\r
-\r
-        errList = new ArrayList<DecodeErrorInfo>();\r
-        result = DecodedContent.lsearchErrorIndex(errList, 10);\r
-        assertEquals(0, result);\r
-\r
-        errList.clear();\r
-        errList.add(new DecodeErrorInfo(5, (byte)0x00));\r
-        result = DecodedContent.lsearchErrorIndex(errList, 10);\r
-        assertEquals(1, result);\r
-\r
-        errList.clear();\r
-        errList.add(new DecodeErrorInfo(10, (byte)0x00));\r
-        result = DecodedContent.lsearchErrorIndex(errList, 10);\r
-        assertEquals(0, result);\r
-\r
-        errList.clear();\r
-        errList.add(new DecodeErrorInfo(15, (byte)0x00));\r
-        result = DecodedContent.lsearchErrorIndex(errList, 10);\r
-        assertEquals(0, result);\r
-\r
-        errList.clear();\r
-        errList.add(new DecodeErrorInfo(4, (byte)0x00));\r
-        errList.add(new DecodeErrorInfo(5, (byte)0x00));\r
-        errList.add(new DecodeErrorInfo(14, (byte)0x00));\r
-        errList.add(new DecodeErrorInfo(15, (byte)0x00));\r
-        result = DecodedContent.lsearchErrorIndex(errList, 10);\r
-        assertEquals(2, result);\r
-\r
-        errList.clear();\r
-        errList.add(new DecodeErrorInfo(4, (byte)0x00));\r
-        errList.add(new DecodeErrorInfo(5, (byte)0x00));\r
-        errList.add(new DecodeErrorInfo(10, (byte)0x00));\r
-        errList.add(new DecodeErrorInfo(14, (byte)0x00));\r
-        errList.add(new DecodeErrorInfo(15, (byte)0x00));\r
-        result = DecodedContent.lsearchErrorIndex(errList, 10);\r
-        assertEquals(2, result);\r
-\r
-        return;\r
-     }\r
-\r
-    /**\r
-     * Test of bsearchErrorIndex method, of class DecodedContent.\r
-     */\r
-    @Test\r
-    public void testBsearchErrorIndex(){\r
-        System.out.println("bsearchErrorIndex");\r
-\r
-        List<DecodeErrorInfo> errList;\r
-        int result;\r
-\r
-        errList = new ArrayList<DecodeErrorInfo>();\r
-        result = DecodedContent.bsearchErrorIndex(errList, 10);\r
-        assertEquals(0, result);\r
-\r
-        errList.clear();\r
-        errList.add(new DecodeErrorInfo(5, (byte)0x00));\r
-        result = DecodedContent.bsearchErrorIndex(errList, 10);\r
-        assertEquals(1, result);\r
-\r
-        errList.clear();\r
-        errList.add(new DecodeErrorInfo(10, (byte)0x00));\r
-        result = DecodedContent.bsearchErrorIndex(errList, 10);\r
-        assertEquals(0, result);\r
-\r
-        errList.clear();\r
-        errList.add(new DecodeErrorInfo(15, (byte)0x00));\r
-        result = DecodedContent.bsearchErrorIndex(errList, 10);\r
-        assertEquals(0, result);\r
-\r
-        errList.clear();\r
-        errList.add(new DecodeErrorInfo(4, (byte)0x00));\r
-        errList.add(new DecodeErrorInfo(5, (byte)0x00));\r
-        errList.add(new DecodeErrorInfo(14, (byte)0x00));\r
-        errList.add(new DecodeErrorInfo(15, (byte)0x00));\r
-        result = DecodedContent.bsearchErrorIndex(errList, 10);\r
-        assertEquals(2, result);\r
-\r
-        errList.clear();\r
-        errList.add(new DecodeErrorInfo(4, (byte)0x00));\r
-        errList.add(new DecodeErrorInfo(5, (byte)0x00));\r
-        errList.add(new DecodeErrorInfo(10, (byte)0x00));\r
-        errList.add(new DecodeErrorInfo(14, (byte)0x00));\r
-        errList.add(new DecodeErrorInfo(15, (byte)0x00));\r
-        result = DecodedContent.bsearchErrorIndex(errList, 10);\r
-        assertEquals(2, result);\r
-\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * Test of searchErrorIndex method, of class DecodedContent.\r
-     */\r
-    @Test\r
-    public void testSearchErrorIndex(){\r
-        System.out.println("searchErrorIndex");\r
-\r
-        List<DecodeErrorInfo> errList;\r
-        int result;\r
-\r
-        errList = new ArrayList<DecodeErrorInfo>();\r
-\r
-        errList.clear();\r
-        for(int pos = 0; pos <= 1000; pos += 10){\r
-            errList.add(new DecodeErrorInfo(pos, (byte)0x00));\r
-        }\r
-        result = DecodedContent.searchErrorIndex(errList, 503);\r
-        assertEquals(51, result);\r
-\r
-        errList.clear();\r
-        for(int pos = 0; pos <= 50; pos += 10){\r
-            errList.add(new DecodeErrorInfo(pos, (byte)0x00));\r
-        }\r
-        result = DecodedContent.searchErrorIndex(errList, 23);\r
-        assertEquals(3, result);\r
-\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * Test of appendGappedErrorInfo method, of class DecodedContent.\r
-     */\r
-    @Test\r
-    public void testAppendGappedErrorInfo(){\r
-        System.out.println("appendGappedErrorInfo");\r
-\r
-        DecodedContent sourceContent;\r
-        sourceContent = new DecodedContent();\r
-        for(int pos = 0; pos <= 50; pos += 10){\r
-            sourceContent.append("123456789");\r
-            sourceContent.addDecodeError((byte)0x00);\r
-        }\r
-\r
-        List<DecodeErrorInfo> result;\r
-        result = DecodedContent.appendGappedErrorInfo(sourceContent, 15, 35, null, -100);\r
-        assertNotNull(result);\r
-        assertEquals(2, result.size());\r
-        assertEquals(119, result.get(0).getCharPosition());\r
-        assertEquals(129, result.get(1).getCharPosition());\r
-\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * Test of ensureCapacity method, of class DecodedContent.\r
-     */\r
-    @Test\r
-    public void testEnsureCapacity(){\r
-        System.out.println("ensureCapacity");\r
-\r
-        DecodedContent content;\r
-        \r
-        content = new DecodedContent("abc");\r
-        content.ensureCapacity(-1);\r
-        content.ensureCapacity(0);\r
-        content.ensureCapacity(1);\r
-        content.ensureCapacity(5);\r
-        content.append("def");\r
-        assertEquals("abcdef", content.toString());\r
-\r
-        content = new DecodedContent();\r
-        content.ensureCapacity(5);\r
-        content.append("abc");\r
-        assertEquals("abc", content.toString());\r
-\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * Test of setCharAt method, of class DecodedContent.\r
-     */\r
-    @Test\r
-    public void testSetCharAt(){\r
-        System.out.println("setCharAt");\r
-\r
-        DecodedContent content;\r
-\r
-        content = new DecodedContent("abc");\r
-        content.setCharAt(1, 'B');\r
-        assertEquals("aBc", content.toString());\r
-\r
-        content = new DecodedContent("a");\r
-        content.addDecodeError((byte)0xff);\r
-        content.append('c');\r
-        assertEquals("a?c", content.toString());\r
-        content.setCharAt(1, 'B');\r
-        assertEquals("aBc", content.toString());\r
-        assertEquals(1, content.getDecodeErrorList().size());\r
-        assertEquals(1, content.getDecodeErrorList().get(0).getCharPosition());\r
-        assertEquals((byte)0xff, content.getDecodeErrorList().get(0).getRawByte1st());\r
-\r
-        content = new DecodedContent("abc");\r
-        try{\r
-            content.setCharAt(-1, 'B');\r
-            fail();\r
-        }catch(IndexOutOfBoundsException e){\r
-            // NOTHING\r
-        }\r
-        try{\r
-            content.setCharAt(10, 'B');\r
-            fail();\r
-        }catch(IndexOutOfBoundsException e){\r
-            // NOTHING\r
-        }\r
-\r
-        return;\r
-    }\r
-\r
-}\r
+/*
+ * License : The MIT License
+ * Copyright(c) 2009 olyutorskii
+ */
+
+package jp.sourceforge.jindolf.parser;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ */
+public class DecodedContentTest {
+
+    public DecodedContentTest() {
+    }
+
+    @BeforeClass
+    public static void setUpClass() throws Exception{
+    }
+
+    @AfterClass
+    public static void tearDownClass() throws Exception{
+    }
+
+    @Before
+    public void setUp() {
+    }
+
+    @After
+    public void tearDown() {
+    }
+
+    /**
+     * Test of Constructor, of class DecodedContent.
+     */
+    @Test
+    public void testConstructor(){
+        System.out.println("Constructor");
+
+        DecodedContent content;
+
+        content = new DecodedContent();
+        assertEquals("", content.toString());
+
+        content = new DecodedContent("abc");
+        assertEquals("abc", content.toString());
+
+        content = new DecodedContent(128);
+        assertEquals("", content.toString());
+
+        content = new DecodedContent(0);
+        assertEquals("", content.toString());
+        content.append("abc");
+        assertEquals("abc", content.toString());
+
+        try{
+            new DecodedContent(-1);
+            fail();
+        }catch(NegativeArraySizeException e){
+        }catch(Throwable e){
+            fail();
+        }
+
+        return;
+    }
+
+    /**
+     * Test of init method, of class DecodedContent.
+     */
+    @Test
+    public void testInit(){
+        System.out.println("init");
+
+        DecodedContent content;
+
+        content = new DecodedContent();
+        content.append("abc");
+        content.addDecodeError((byte)0xff);
+        content.append("def");
+        assertEquals("abc?def", content.toString());
+        assertEquals(1, content.getDecodeErrorList().size());
+
+        content.init();
+        assertEquals("", content.toString());
+        assertEquals(0, content.getDecodeErrorList().size());
+
+        content.append('X');
+        assertEquals("X", content.toString());
+
+        return;
+    }
+
+    /**
+     * Test of hasDecodeError method, of class DecodedContent.
+     */
+    @Test
+    public void testHasDecodeError(){
+        System.out.println("hasDecodeError");
+
+        DecodedContent content;
+
+        content = new DecodedContent();
+        assertFalse(content.hasDecodeError());
+
+        content.append("a");
+        assertFalse(content.hasDecodeError());
+
+        content.addDecodeError((byte)0xff);
+        assertTrue(content.hasDecodeError());
+
+        content.append("b");
+        assertTrue(content.hasDecodeError());
+
+        content.init();
+        assertFalse(content.hasDecodeError());
+
+        content.append("c");
+        assertFalse(content.hasDecodeError());
+
+        content = new DecodedContent();
+        List<DecodeErrorInfo> list = content.getDecodeErrorList();
+        assertEquals(0, list.size());
+        assertFalse(content.hasDecodeError());
+
+        return;
+    }
+
+    /**
+     * Test of getDecodeErrorList method, of class DecodedContent.
+     */
+    @Test
+    public void testGetDecodeErrorList(){
+        System.out.println("getDecodeErrorList");
+
+        DecodedContent content;
+        List<DecodeErrorInfo> list;
+
+        content = new DecodedContent();
+        list = content.getDecodeErrorList();
+        assertEquals(0, list.size());
+
+        content.append("abc");
+        list = content.getDecodeErrorList();
+        assertEquals(0, list.size());
+
+        content.addDecodeError((byte)0xff);
+        list = content.getDecodeErrorList();
+        assertEquals(1, list.size());
+
+        content.append("def");
+        list = content.getDecodeErrorList();
+        assertEquals(1, list.size());
+
+        content.addDecodeError((byte)0x03, (byte)0x04);
+        list = content.getDecodeErrorList();
+        assertEquals(2, list.size());
+
+        return;
+    }
+
+    /**
+     * Test of getRawContent method, of class DecodedContent.
+     */
+    @Test
+    public void testGetRawContent(){
+        System.out.println("getRawContent");
+
+        DecodedContent content;
+
+        content = new DecodedContent();
+        assertEquals("", content.getRawContent().toString());
+
+        content.append("a");
+        assertEquals("a", content.getRawContent().toString());
+
+        content.addDecodeError((byte)0xff);
+        assertEquals("a?", content.getRawContent().toString());
+
+        content.append("b");
+        assertEquals("a?b", content.getRawContent().toString());
+
+        assertEquals(content.toString(), content.getRawContent().toString());
+
+        return;
+    }
+
+    /**
+     * Test of charAt method, of class DecodedContent.
+     */
+    @Test
+    public void testCharAt(){
+        System.out.println("charAt");
+
+        DecodedContent content;
+
+        content = new DecodedContent();
+        content.append("12345");
+        assertEquals('1', content.charAt(0));
+        assertEquals('3', content.charAt(2));
+        assertEquals('5', content.charAt(4));
+
+        try{
+            content.charAt(-1);
+            fail();
+        }catch(IndexOutOfBoundsException e){
+        }catch(Throwable e){
+            fail();
+        }
+
+        try{
+            content.charAt(5);
+            fail();
+        }catch(IndexOutOfBoundsException e){
+        }catch(Throwable e){
+            fail();
+        }
+
+        return;
+    }
+
+    /**
+     * Test of length method, of class DecodedContent.
+     */
+    @Test
+    public void testLength(){
+        System.out.println("length");
+
+        DecodedContent content;
+
+        content = new DecodedContent();
+        assertEquals(0, content.length());
+
+        content.append("12345");
+        assertEquals(5, content.length());
+
+        content.addDecodeError((byte)0xff);
+        assertEquals(6, content.length());
+
+        content.init();
+        assertEquals(0, content.length());
+
+        return;
+    }
+
+    /**
+     * Test of subSequence method, of class DecodedContent.
+     */
+    @Test
+    public void testSubSequence(){
+        System.out.println("subSequence");
+
+        DecodedContent content;
+
+        content = new DecodedContent();
+
+        content.append("12345");
+        assertEquals("234", content.subSequence(1, 4).toString());
+
+        try{
+            content.subSequence(-1, 4);
+            fail();
+        }catch(IndexOutOfBoundsException e){
+        }catch(Throwable e){
+            fail();
+        }
+
+        try{
+            content.subSequence(1, 6);
+            fail();
+        }catch(IndexOutOfBoundsException e){
+        }catch(Throwable e){
+            fail();
+        }
+
+        try{
+            content.subSequence(4, 1);
+            fail();
+        }catch(IndexOutOfBoundsException e){
+        }catch(Throwable e){
+            fail();
+        }
+
+        return;
+    }
+
+    /**
+     * Test of subContent method, of class DecodedContent.
+     */
+    @Test
+    public void testSubContent(){
+        System.out.println("subContent");
+
+        DecodedContent content;
+
+        content = new DecodedContent();
+
+        content.append("12345");
+        assertEquals("234", content.subContent(1, 4).toString());
+
+        try{
+            content.subContent(-1, 4);
+            fail();
+        }catch(IndexOutOfBoundsException e){
+        }catch(Throwable e){
+            fail();
+        }
+
+        try{
+            content.subContent(1, 6);
+            fail();
+        }catch(IndexOutOfBoundsException e){
+        }catch(Throwable e){
+            fail();
+        }
+
+        try{
+            content.subContent(4, 1);
+            fail();
+        }catch(IndexOutOfBoundsException e){
+        }catch(Throwable e){
+            fail();
+        }
+
+        content = new DecodedContent();
+        content.append("ab");
+        content.addDecodeError((byte)0x01);
+        content.append("de");
+        content = content.subContent(1,4);
+        assertEquals("b?d", content.toString());
+
+        List<DecodeErrorInfo> list = content.getDecodeErrorList();
+        assertEquals(1, list.size());
+        assertEquals((byte)0x01, list.get(0).getRawByte1st());
+
+        return;
+    }
+
+    /**
+     * Test of append method, of class DecodedContent.
+     */
+    @Test
+    public void testAppend_char(){
+        System.out.println("append");
+
+        DecodedContent content;
+
+        content = new DecodedContent();
+        content.append('a');
+        assertEquals("a", content.toString());
+
+        return;
+    }
+
+    /**
+     * Test of append method, of class DecodedContent.
+     */
+    @Test
+    public void testAppend_CharSequence(){
+        System.out.println("append");
+
+        DecodedContent content;
+
+        content = new DecodedContent();
+        CharSequence seq = "abc";
+        content.append(seq);
+        assertEquals("abc", content.toString());
+
+        return;
+    }
+
+    /**
+     * Test of append method, of class DecodedContent.
+     */
+    @Test
+    public void testAppend_3args_1(){
+        System.out.println("append");
+
+        DecodedContent content;
+
+        content = new DecodedContent();
+        content.append("abc");
+        assertEquals("abc", content.toString());
+
+        CharSequence seq = "12345";
+        content.append(seq, 1, 4);
+        assertEquals("abc234", content.toString());
+
+        return;
+    }
+
+    /**
+     * Test of append method, of class DecodedContent.
+     */
+    @Test
+    public void testAppend_3args_2(){
+        System.out.println("append");
+
+        DecodedContent content;
+
+        content = new DecodedContent();
+        content.append("abc");
+
+        DecodedContent other;
+        other = new DecodedContent();
+        other.append("12345");
+
+        content.append(other, 1, 4);
+        assertEquals("abc234", content.toString());
+
+        content = new DecodedContent();
+        content.append("abc");
+
+        other = new DecodedContent();
+        other.addDecodeError((byte)0x01);
+        other.addDecodeError((byte)0x02);
+        other.addDecodeError((byte)0x03);
+        other.addDecodeError((byte)0x04);
+        other.addDecodeError((byte)0x05);
+
+        content.append(other, 1, 4);
+        assertEquals("abc???", content.toString());
+
+        List<DecodeErrorInfo> list = content.getDecodeErrorList();
+        assertEquals(3, list.size());
+
+        DecodeErrorInfo info;
+
+        info = list.get(0);
+        assertEquals(3, info.getCharPosition());
+        assertEquals((byte)0x02, info.getRawByte1st());
+        info = list.get(1);
+        assertEquals(4, info.getCharPosition());
+        assertEquals((byte)0x03, info.getRawByte1st());
+        info = list.get(2);
+        assertEquals(5, info.getCharPosition());
+        assertEquals((byte)0x04, info.getRawByte1st());
+
+        return;
+    }
+
+    /**
+     * Test of addDecodeError method, of class DecodedContent.
+     */
+    @Test
+    public void testAddDecodeError_byte(){
+        System.out.println("addDecodeError");
+
+        DecodedContent content;
+
+        content = new DecodedContent();
+        content.append("abc");
+        content.addDecodeError((byte)0xfe);
+        content.append("def");
+        content.addDecodeError((byte)0xff);
+
+        assertEquals("abc?def?", content.toString());
+        List<DecodeErrorInfo> list = content.getDecodeErrorList();
+        assertEquals(2, list.size());
+
+        DecodeErrorInfo info;
+
+        info = list.get(0);
+        assertEquals(3, list.get(0).getCharPosition());
+        assertFalse(info.has2nd());
+        assertEquals((byte)0xfe, info.getRawByte1st());
+
+        info = list.get(1);
+        assertEquals(7, info.getCharPosition());
+        assertFalse(info.has2nd());
+        assertEquals((byte)0xff, info.getRawByte1st());
+
+        return;
+    }
+
+    /**
+     * Test of addDecodeError method, of class DecodedContent.
+     */
+    @Test
+    public void testAddDecodeError_byte_byte(){
+        System.out.println("addDecodeError");
+
+        DecodedContent content;
+
+        content = new DecodedContent();
+        content.append("abc");
+        content.addDecodeError((byte)0x01, (byte)0x02);
+        content.append("def");
+        content.addDecodeError((byte)0xfe, (byte)0xff);
+
+        assertEquals("abc?def?", content.toString());
+        List<DecodeErrorInfo> list = content.getDecodeErrorList();
+        assertEquals(2, list.size());
+
+        DecodeErrorInfo info;
+
+        info = list.get(0);
+        assertEquals(3, list.get(0).getCharPosition());
+        assertTrue(info.has2nd());
+        assertEquals((byte)0x01, info.getRawByte1st());
+        assertEquals((byte)0x02, info.getRawByte2nd());
+
+        info = list.get(1);
+        assertEquals(7, info.getCharPosition());
+        assertTrue(info.has2nd());
+        assertEquals((byte)0xfe, info.getRawByte1st());
+        assertEquals((byte)0xff, info.getRawByte2nd());
+
+        return;
+    }
+
+    /**
+     * Test of toString method, of class DecodedContent.
+     */
+    @Test
+    public void testToString(){
+        System.out.println("toString");
+
+        DecodedContent content;
+
+        content = new DecodedContent();
+        content.append("abc");
+        content.addDecodeError((byte)0x01, (byte)0x02);
+        content.append("def");
+        content.addDecodeError((byte)0xfe, (byte)0xff);
+
+        assertEquals("abc?def?", content.toString());
+        assertEquals(content.getRawContent().toString(), content.toString());
+
+        return;
+    }
+
+    /**
+     * Test of lsearchErrorIndex method, of class DecodedContent.
+     */
+    @Test
+    public void testLsearchErrorIndex(){
+        System.out.println("lsearchErrorIndex");
+
+        List<DecodeErrorInfo> errList;
+        int result;
+
+        errList = new ArrayList<>();
+        result = DecodedContent.lsearchErrorIndex(errList, 10);
+        assertEquals(0, result);
+
+        errList.clear();
+        errList.add(new DecodeErrorInfo(5, (byte)0x00));
+        result = DecodedContent.lsearchErrorIndex(errList, 10);
+        assertEquals(1, result);
+
+        errList.clear();
+        errList.add(new DecodeErrorInfo(10, (byte)0x00));
+        result = DecodedContent.lsearchErrorIndex(errList, 10);
+        assertEquals(0, result);
+
+        errList.clear();
+        errList.add(new DecodeErrorInfo(15, (byte)0x00));
+        result = DecodedContent.lsearchErrorIndex(errList, 10);
+        assertEquals(0, result);
+
+        errList.clear();
+        errList.add(new DecodeErrorInfo(4, (byte)0x00));
+        errList.add(new DecodeErrorInfo(5, (byte)0x00));
+        errList.add(new DecodeErrorInfo(14, (byte)0x00));
+        errList.add(new DecodeErrorInfo(15, (byte)0x00));
+        result = DecodedContent.lsearchErrorIndex(errList, 10);
+        assertEquals(2, result);
+
+        errList.clear();
+        errList.add(new DecodeErrorInfo(4, (byte)0x00));
+        errList.add(new DecodeErrorInfo(5, (byte)0x00));
+        errList.add(new DecodeErrorInfo(10, (byte)0x00));
+        errList.add(new DecodeErrorInfo(14, (byte)0x00));
+        errList.add(new DecodeErrorInfo(15, (byte)0x00));
+        result = DecodedContent.lsearchErrorIndex(errList, 10);
+        assertEquals(2, result);
+
+        return;
+     }
+
+    /**
+     * Test of bsearchErrorIndex method, of class DecodedContent.
+     */
+    @Test
+    public void testBsearchErrorIndex(){
+        System.out.println("bsearchErrorIndex");
+
+        List<DecodeErrorInfo> errList;
+        int result;
+
+        errList = new ArrayList<>();
+        result = DecodedContent.bsearchErrorIndex(errList, 10);
+        assertEquals(0, result);
+
+        errList.clear();
+        errList.add(new DecodeErrorInfo(5, (byte)0x00));
+        result = DecodedContent.bsearchErrorIndex(errList, 10);
+        assertEquals(1, result);
+
+        errList.clear();
+        errList.add(new DecodeErrorInfo(10, (byte)0x00));
+        result = DecodedContent.bsearchErrorIndex(errList, 10);
+        assertEquals(0, result);
+
+        errList.clear();
+        errList.add(new DecodeErrorInfo(15, (byte)0x00));
+        result = DecodedContent.bsearchErrorIndex(errList, 10);
+        assertEquals(0, result);
+
+        errList.clear();
+        errList.add(new DecodeErrorInfo(4, (byte)0x00));
+        errList.add(new DecodeErrorInfo(5, (byte)0x00));
+        errList.add(new DecodeErrorInfo(14, (byte)0x00));
+        errList.add(new DecodeErrorInfo(15, (byte)0x00));
+        result = DecodedContent.bsearchErrorIndex(errList, 10);
+        assertEquals(2, result);
+
+        errList.clear();
+        errList.add(new DecodeErrorInfo(4, (byte)0x00));
+        errList.add(new DecodeErrorInfo(5, (byte)0x00));
+        errList.add(new DecodeErrorInfo(10, (byte)0x00));
+        errList.add(new DecodeErrorInfo(14, (byte)0x00));
+        errList.add(new DecodeErrorInfo(15, (byte)0x00));
+        result = DecodedContent.bsearchErrorIndex(errList, 10);
+        assertEquals(2, result);
+
+        return;
+    }
+
+    /**
+     * Test of searchErrorIndex method, of class DecodedContent.
+     */
+    @Test
+    public void testSearchErrorIndex(){
+        System.out.println("searchErrorIndex");
+
+        List<DecodeErrorInfo> errList;
+        int result;
+
+        errList = new ArrayList<>();
+
+        errList.clear();
+        for(int pos = 0; pos <= 1000; pos += 10){
+            errList.add(new DecodeErrorInfo(pos, (byte)0x00));
+        }
+        result = DecodedContent.searchErrorIndex(errList, 503);
+        assertEquals(51, result);
+
+        errList.clear();
+        for(int pos = 0; pos <= 50; pos += 10){
+            errList.add(new DecodeErrorInfo(pos, (byte)0x00));
+        }
+        result = DecodedContent.searchErrorIndex(errList, 23);
+        assertEquals(3, result);
+
+        return;
+    }
+
+    /**
+     * Test of appendGappedErrorInfo method, of class DecodedContent.
+     */
+    @Test
+    public void testAppendGappedErrorInfo(){
+        System.out.println("appendGappedErrorInfo");
+
+        DecodedContent sourceContent;
+        sourceContent = new DecodedContent();
+        for(int pos = 0; pos <= 50; pos += 10){
+            sourceContent.append("123456789");
+            sourceContent.addDecodeError((byte)0x00);
+        }
+
+        List<DecodeErrorInfo> result;
+        result = DecodedContent.appendGappedErrorInfo(sourceContent, 15, 35, null, -100);
+        assertNotNull(result);
+        assertEquals(2, result.size());
+        assertEquals(119, result.get(0).getCharPosition());
+        assertEquals(129, result.get(1).getCharPosition());
+
+        return;
+    }
+
+    /**
+     * Test of ensureCapacity method, of class DecodedContent.
+     */
+    @Test
+    public void testEnsureCapacity(){
+        System.out.println("ensureCapacity");
+
+        DecodedContent content;
+
+        content = new DecodedContent("abc");
+        content.ensureCapacity(-1);
+        content.ensureCapacity(0);
+        content.ensureCapacity(1);
+        content.ensureCapacity(5);
+        content.append("def");
+        assertEquals("abcdef", content.toString());
+
+        content = new DecodedContent();
+        content.ensureCapacity(5);
+        content.append("abc");
+        assertEquals("abc", content.toString());
+
+        return;
+    }
+
+    /**
+     * Test of setCharAt method, of class DecodedContent.
+     */
+    @Test
+    public void testSetCharAt(){
+        System.out.println("setCharAt");
+
+        DecodedContent content;
+
+        content = new DecodedContent("abc");
+        content.setCharAt(1, 'B');
+        assertEquals("aBc", content.toString());
+
+        content = new DecodedContent("a");
+        content.addDecodeError((byte)0xff);
+        content.append('c');
+        assertEquals("a?c", content.toString());
+        content.setCharAt(1, 'B');
+        assertEquals("aBc", content.toString());
+        assertEquals(1, content.getDecodeErrorList().size());
+        assertEquals(1, content.getDecodeErrorList().get(0).getCharPosition());
+        assertEquals((byte)0xff, content.getDecodeErrorList().get(0).getRawByte1st());
+
+        content = new DecodedContent("abc");
+        try{
+            content.setCharAt(-1, 'B');
+            fail();
+        }catch(IndexOutOfBoundsException e){
+            // NOTHING
+        }
+        try{
+            content.setCharAt(10, 'B');
+            fail();
+        }catch(IndexOutOfBoundsException e){
+            // NOTHING
+        }
+
+        return;
+    }
+
+}