add support set_get_

This commit is contained in:
wenshao
2013-07-09 11:06:50 +08:00
parent f85f1871b1
commit aaaa4d5670
5 changed files with 122 additions and 3 deletions
@@ -0,0 +1,38 @@
package com.alibaba.json.bvt.fullSer;
import junit.framework.TestCase;
import org.junit.Assert;
import com.alibaba.fastjson.JSON;
import com.alibaba.json.bvt.fullSer.get_set_Test.VO;
public class getfTest extends TestCase {
public void test_codec() throws Exception {
VO vo = new VO();
vo.setfId(123);
String text = JSON.toJSONString(vo);
Assert.assertEquals("{\"fId\":123}", text);
VO vo1 = JSON.parseObject(text, VO.class);
Assert.assertEquals(123, vo1.getfId());
}
public static class VO {
private int fId;
public int getfId() {
return fId;
}
public void setfId(int fId) {
this.fId = fId;
}
}
}
@@ -0,0 +1,35 @@
package com.alibaba.json.bvt.fullSer;
import junit.framework.TestCase;
import org.junit.Assert;
import com.alibaba.fastjson.JSON;
import com.alibaba.json.bvt.fullSer.get_set_Test.VO;
public class getfTest_2 extends TestCase {
public void test_codec() throws Exception {
VO vo = new VO();
vo.setfFlag(true);
String text = JSON.toJSONString(vo);
Assert.assertEquals("{\"fFlag\":true}", text);
VO vo1 = JSON.parseObject(text, VO.class);
Assert.assertEquals(true, vo1.isfFlag());
}
public static class VO {
private boolean fFlag;
public boolean isfFlag() {
return fFlag;
}
public void setfFlag(boolean fFlag) {
this.fFlag = fFlag;
}
}
}
@@ -0,0 +1,35 @@
package com.alibaba.json.bvt.fullSer;
import junit.framework.TestCase;
import org.junit.Assert;
import com.alibaba.fastjson.JSON;
import com.alibaba.json.bvt.fullSer.get_set_Test.VO;
public class is_set_test_2 extends TestCase {
public void test_codec() throws Exception {
VO vo = new VO();
vo.set_flag(true);
String text = JSON.toJSONString(vo);
Assert.assertEquals("{\"flag\":true}", text);
VO vo1 = JSON.parseObject(text, VO.class);
Assert.assertEquals(true, vo1.is_flag());
}
public static class VO {
private boolean flag;
public boolean is_flag() {
return flag;
}
public void set_flag(boolean flag) {
this.flag = flag;
}
}
}