Package com.alibaba.json.bvt.parser.stream

Source Code of com.alibaba.json.bvt.parser.stream.JSONReaderScannerTest_matchField

package com.alibaba.json.bvt.parser.stream;

import java.util.List;

import junit.framework.TestCase;

import org.junit.Assert;

import com.alibaba.fastjson.parser.DefaultJSONParser;
import com.alibaba.fastjson.parser.JSONReaderScanner;

public class JSONReaderScannerTest_matchField extends TestCase {

    public void test_true() throws Exception {
        DefaultJSONParser parser = new DefaultJSONParser(new JSONReaderScanner("{\"items\":[{}],\"value\":{}}"));
        VO vo = parser.parseObject(VO.class);
        Assert.assertNotNull(vo.getValue());
        Assert.assertNotNull(vo.getItems());
        Assert.assertEquals(1, vo.getItems().size());
        Assert.assertNotNull(vo.getItems().get(0));
        parser.close();
    }

    public static class VO {

        private List<Item> items;
        private Entity     value;

        public Entity getValue() {
            return value;
        }

        public void setValue(Entity value) {
            this.value = value;
        }

        public List<Item> getItems() {
            return items;
        }

        public void setItems(List<Item> items) {
            this.items = items;
        }

    }

    public static class Entity {

    }

    public static class Item {

    }
}
TOP

Related Classes of com.alibaba.json.bvt.parser.stream.JSONReaderScannerTest_matchField

TOP
Copyright © 2018 www.massapi.com. 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.