package com.alibaba.json.bvt.path;

import java.util.List;

import junit.framework.TestCase;

import org.junit.Assert;

import com.alibaba.fastjson.JSONPath;

public class JSONPath_field_access_multi extends TestCase {

    public void test_list_map() throws Exception {
        Entity entity = new Entity(123, "wenshao");
        JSONPath path = new JSONPath("$['id','name']");
        
        List<Object> result = (List<Object>) path.eval(entity);
        Assert.assertSame(entity.getId(), result.get(0));
        Assert.assertSame(entity.getName(), result.get(1));
    }

    public static class Entity {

        private Integer id;
        private String  name;

        public Entity(Integer id, String name){
            this.id = id;
            this.name = name;
        }

        public Integer getId() {
            return id;
        }

        public void setId(Integer id) {
            this.id = id;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

    }
}

@@ -566,24 +566,444 @@
 1));%0A    %7D%0A%0A
+    public void test_list_map2() throws Exception %7B%0A        Entity entity = new Entity(123, %22wenshao%22);%0A        JSONPath path = new JSONPath(%22$.entity%5B'id','name'%5D%22);%0A%0A        Root root = new Root();%0A        root.setEntity(entity);%0A%0A        List%3CObject%3E result = (List%3CObject%3E) path.eval(root);%0A        Assert.assertSame(entity.getId(), result.get(0));%0A        Assert.assertSame(entity.getName(), result.get(1));%0A    %7D%0A%0A
     public s
@@ -1501,11 +1501,262 @@
 %7D%0A%0A    %7D
+%0A%0A    public static class Root %7B%0A        private Entity entity;%0A%0A        public Entity getEntity()%0A        %7B%0A            return entity;%0A        %7D%0A%0A        public void setEntity(Entity entity)%0A        %7B%0A            this.entity = entity;%0A        %7D%0A    %7D
 %0A%7D%0A

add testcase for multi-property