package com.alibaba.json.bvt.issue_1200;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.json.bvt.bug.Bug_101_for_rongganlin_case2;
import junit.framework.TestCase;
import org.apache.commons.beanutils.BeanUtils;

import java.util.Map;

/**
 * Created by kimmking on 09/06/2017.
 */
public class Issue1254 extends TestCase {
    public void test_for_issue() throws Exception {
        A a = new A();
        a._parentId = "001";
        String test = JSON.toJSONString(a);
        System.out.println(test);
        assertEquals("{\"_parentId\":\"001\"}", test);

        B b = new B();
        b.set_parentId("001");


//        Object o = BeanUtils.getProperty(b,"_parentId");
//        System.out.println(o); //test ok, println 001
//
//        //BeanUtils.getProperty(b,"parentId"); //java.lang.NoSuchMethodException: Unknown property 'parentId' on class 'class com.alibaba.json.bvt.issue_1200.Issue1254$B'

        String testB = JSON.toJSONString(b);
        System.out.println(testB);
        assertEquals("{\"_parentId\":\"001\"}", testB);

    }

    public static class A {
        public String _parentId;
    }

    public static class B {
        private String _parentId;

        public String get_parentId() {
            return _parentId;
        }

        public void set_parentId(String _parentId) {
            this._parentId = _parentId;
        }
    }
}

@@ -671,300 +671,8 @@
 ;%0A%0A%0A
-//        Object o = BeanUtils.getProperty(b,%22_parentId%22);%0A//        System.out.println(o); //test ok, println 001%0A//%0A//        //BeanUtils.getProperty(b,%22parentId%22); //java.lang.NoSuchMethodException: Unknown property 'parentId' on class 'class com.alibaba.json.bvt.issue_1200.Issue1254$B'%0A%0A
     
@@ -871,32 +871,32 @@
 arentId;%0A    %7D%0A%0A
-
     public stati
@@ -907,16 +907,55 @@
 ass B %7B%0A
+        @JSONField(name = %22_parentId%22)%0A
         

add testcase for issue #1254