Package cc.plural.jsonij

Examples of cc.plural.jsonij.JSONReader


     * @throws ParserException
     */
    @Test
    public void testParseString1() throws IOException, ParserException {
        String testString = "\"John\"";
        JSONReader target = new StringJSONReader(testString);
        JSON.String value = parser.parseString(target);
        if (!value.toString().equals("John")) {
            fail();
        }
    }
View Full Code Here


    @Test
    public void testParseString2() throws IOException, ParserException {
        String testString = "\"John\"\"Marsden\"";
        ByteArrayInputStream targetArrayStream = new ByteArrayInputStream(testString.getBytes());
        InputStreamReader targetReader = new InputStreamReader(targetArrayStream);
        JSONReader target = new ReaderJSONReader(targetReader);
        JSON.String value1 = parser.parseString(target);
        JSON.String value2 = parser.parseString(target);
        targetReader.close();
        targetArrayStream.close();
        assertEquals("John", value1.toString());
View Full Code Here

    @Test
    public void testParseString3() throws IOException, ParserException {
        String testString = "\"John\\tcool\"";
        ByteArrayInputStream targetArrayStream = new ByteArrayInputStream(testString.getBytes());
        InputStreamReader targetReader = new InputStreamReader(targetArrayStream);
        JSONReader target = new ReaderJSONReader(targetReader);
        JSON.String value = parser.parseString(target);
        targetReader.close();
        targetArrayStream.close();
        assertEquals("John\tcool", value.toString());
    }
View Full Code Here

    @Test
    public void testParseString4() throws IOException, ParserException {
        String testString = "\"Gah: \\u5b66\"";
        ByteArrayInputStream targetArrayStream = new ByteArrayInputStream(testString.getBytes());
        InputStreamReader targetReader = new InputStreamReader(targetArrayStream);
        JSONReader target = new ReaderJSONReader(targetReader);
        JSON.String value = parser.parseString(target);
        targetReader.close();
        targetArrayStream.close();
        assertEquals("Gah: \u5b66", value.toString());
    }
View Full Code Here

    @Test
    public void testParseString5() throws IOException, ParserException {
        String testString = "\"Gah: \\ud801\\udc01\"";
        ByteArrayInputStream targetArrayStream = new ByteArrayInputStream(testString.getBytes());
        InputStreamReader targetReader = new InputStreamReader(targetArrayStream);
        JSONReader target = new ReaderJSONReader(targetReader);
        JSON.String value = parser.parseString(target);
        targetReader.close();
        targetArrayStream.close();
        assertEquals("Gah: \ud801\udc01", value.toString());
    }
View Full Code Here

    }

    @Test
    public void testStringDecodeEncode() throws IOException, ParserException {
        String jsonString = "\"John\\tMarsden\"";
        JSONReader target = new StringJSONReader(jsonString);
        JSON.String value = parser.parseString(target);
        assertEquals(value.toString(),"John\tMarsden");
        assertEquals(value.toJSON(),"\"John\\tMarsden\"");

        jsonString = "\"\\u5b66\"";
View Full Code Here

TOP

Related Classes of cc.plural.jsonij.JSONReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.