Package com.alibaba.fastjson.parser.deserializer

Examples of com.alibaba.fastjson.parser.deserializer.DefaultObjectDeserializer


    public void test_0() throws Exception {
        String input = "{map:{}}";
        DefaultExtJSONParser parser = new DefaultExtJSONParser(input, ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);

        DefaultObjectDeserializer deser = new DefaultObjectDeserializer();

        Map<String, Object> map = new HashMap<String, Object>();
        deser.parseMap(parser, map, new TypeReference<TreeMap>() {
        }.getType(), null);
        Assert.assertTrue(map.get("map") instanceof TreeMap);
    }
View Full Code Here


   
    public void test_1() throws Exception {
        String input = "{map:{},,,}";
        DefaultExtJSONParser parser = new DefaultExtJSONParser(input, ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);

        DefaultObjectDeserializer deser = new DefaultObjectDeserializer();

        Map<String, Object> map = new HashMap<String, Object>();
        deser.parseMap(parser, map, new TypeReference<TreeMap>() {
        }.getType(), null);
        Assert.assertTrue(map.get("map") instanceof TreeMap);
        Assert.assertEquals(1, map.size());
    }
View Full Code Here

    public void test_error() throws Exception {
        String input = "[}";
        DefaultExtJSONParser parser = new DefaultExtJSONParser(input, ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);

        DefaultObjectDeserializer deser = new DefaultObjectDeserializer();

        Map<String, Object> map = new HashMap<String, Object>();

        JSONException error = null;
        try {
            deser.parseMap(parser, map, new TypeReference<TreeMap>() {
            }.getType(), null);
        } catch (JSONException ex) {
            error = ex;
        }
        Assert.assertNotNull(error);
View Full Code Here

   
    public void test_error_1() throws Exception {
        String input = "{]";
        DefaultExtJSONParser parser = new DefaultExtJSONParser(input, ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);

        DefaultObjectDeserializer deser = new DefaultObjectDeserializer();

        Map<String, Object> map = new HashMap<String, Object>();

        JSONException error = null;
        try {
            deser.parseMap(parser, map, new TypeReference<TreeMap>() {
            }.getType(), null);
        } catch (JSONException ex) {
            error = ex;
        }
        Assert.assertNotNull(error);
View Full Code Here

   
    public void test_error_2() throws Exception {
        String input = "{map:{},,,}";
        DefaultExtJSONParser parser = new DefaultExtJSONParser(input, ParserConfig.getGlobalInstance(), 0);

        DefaultObjectDeserializer deser = new DefaultObjectDeserializer();

        Map<String, Object> map = new HashMap<String, Object>();

        JSONException error = null;
        try {
            deser.parseMap(parser, map, new TypeReference<TreeMap>() {
            }.getType(), null);
        } catch (JSONException ex) {
            error = ex;
        }
        Assert.assertNotNull(error);
View Full Code Here

   
    public void test_error_3() throws Exception {
        String input = "{map:{}}";
        DefaultExtJSONParser parser = new DefaultExtJSONParser(input, ParserConfig.getGlobalInstance(), 0);

        DefaultObjectDeserializer deser = new DefaultObjectDeserializer();

        Map<String, Object> map = new HashMap<String, Object>();

        JSONException error = null;
        try {
            deser.parseMap(parser, map, new TypeReference<TreeMap>() {
            }.getType(), null);
        } catch (JSONException ex) {
            error = ex;
        }
        Assert.assertNotNull(error);
View Full Code Here

    public void test_0() throws Exception {
        String input = "{'map':{}}";
        DefaultExtJSONParser parser = new DefaultExtJSONParser(input, ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);

        DefaultObjectDeserializer deser = new DefaultObjectDeserializer();

        Map<String, Object> map = new HashMap<String, Object>();
        deser.parseMap(parser, map, new TypeReference<TreeMap>() {
        }.getType(), null);
        Assert.assertTrue(map.get("map") instanceof TreeMap);
    }
View Full Code Here

    public void test_1() throws Exception {
        String input = "{'map':null}";
        DefaultExtJSONParser parser = new DefaultExtJSONParser(input, ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);

        DefaultObjectDeserializer deser = new DefaultObjectDeserializer();

        Map<String, Object> map = new HashMap<String, Object>();
        deser.parseMap(parser, map, new TypeReference<TreeMap>() {
        }.getType(), null);
        Assert.assertTrue(map.get("map") == null);
    }
View Full Code Here

    public void test_error_0() throws Exception {

        String input = "{\"map\" {} }";
        DefaultExtJSONParser parser = new DefaultExtJSONParser(input, ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);

        DefaultObjectDeserializer deser = new DefaultObjectDeserializer();

        Throwable error = null;

        try {
            Map<String, Object> map = new HashMap<String, Object>();
            deser.parseMap(parser, map, new TypeReference<TreeMap>() {
            }.getType(), null);
        } catch (Throwable ex) {
            error = ex;
        }
View Full Code Here

    public void test_error_1() throws Exception {
        String input = "{'map': 'aaa' }";
        DefaultExtJSONParser parser = new DefaultExtJSONParser(input, ParserConfig.getGlobalInstance(), 0);

        DefaultObjectDeserializer deser = new DefaultObjectDeserializer();

        Throwable error = null;

        try {
            Map<String, Object> map = new HashMap<String, Object>();
            deser.parseMap(parser, map, new TypeReference<TreeMap>() {
            }.getType(), null);
        } catch (Throwable ex) {
            error = ex;
        }
View Full Code Here

TOP

Related Classes of com.alibaba.fastjson.parser.deserializer.DefaultObjectDeserializer

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.