Package com.alibaba.fastjson.parser

Examples of com.alibaba.fastjson.parser.DefaultExtJSONParser


public class DefaultObjectDeserializerTest2 extends TestCase {

    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, TreeMap> map = JSON.parseObject(input, new TypeReference<Map<String, TreeMap>>() {
        }.getType());
View Full Code Here


        Assert.assertTrue(map.get("map") instanceof TreeMap);
    }

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


        SortedMap<String, SortedMap> map = JSON.parseObject(input, new TypeReference<SortedMap<String, SortedMap>>() {
        }.getType());
View Full Code Here

        Assert.assertEquals(TreeMap.class, map.get("map").getClass());
    }

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

        DefaultObjectDeserializer deser = new DefaultObjectDeserializer();

        SortedMap<String, Map> map = JSON.parseObject(input, new TypeReference<SortedMap<String, Map>>() {
        }.getType());
View Full Code Here

        Assert.assertEquals(AntiCollisionHashMap.class, map.get("map").getClass());
    }

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

        DefaultObjectDeserializer deser = new DefaultObjectDeserializer();

        SortedMap<String, ConcurrentMap> map = JSON.parseObject(input, new TypeReference<SortedMap<String, ConcurrentMap>>() {
        }.getType());
View Full Code Here

        Assert.assertEquals(ConcurrentHashMap.class, map.get("map").getClass());
    }

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

        DefaultObjectDeserializer deser = new DefaultObjectDeserializer();

        SortedMap<String, HashMap> map = JSON.parseObject(input, new TypeReference<SortedMap<String, HashMap>>() {
        }.getType());
View Full Code Here

        Assert.assertEquals(HashMap.class, map.get("map").getClass());
    }

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

        DefaultObjectDeserializer deser = new DefaultObjectDeserializer();

        HashMap<String, HashMap> map = JSON.parseObject(input, new TypeReference<HashMap<String, HashMap>>() {
        }.getType());
View Full Code Here

        Assert.assertEquals(HashMap.class, map.get("map").getClass());
    }

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

        DefaultObjectDeserializer deser = new DefaultObjectDeserializer();

        Map map = JSON.parseObject(input, new TypeReference<JSONObject>() {
        }.getType());
View Full Code Here

        Assert.assertEquals(JSONObject.class, map.get("map").getClass());
    }

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

        DefaultObjectDeserializer deser = new DefaultObjectDeserializer();

        TreeMap<String, HashMap> map = JSON.parseObject(input, new TypeReference<TreeMap<String, HashMap>>() {
        }.getType());
View Full Code Here

        Assert.assertEquals(HashMap.class, map.get("map").getClass());
    }

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

        DefaultObjectDeserializer deser = new DefaultObjectDeserializer();

        Object val = null;
        Exception error = null;
View Full Code Here

import com.alibaba.fastjson.parser.Feature;

public class DefaultExtJSONParserTest_7 extends TestCase {

    public void test_parse() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("1");
        Assert.assertEquals(Integer.valueOf(1), parser.parse());

        Exception error = null;
        try {
            parser.parse();
        } catch (Exception ex) {
            error = ex;
        }
        Assert.assertNotNull(error);
    }
View Full Code Here

TOP

Related Classes of com.alibaba.fastjson.parser.DefaultExtJSONParser

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.