mirror of
https://github.com/alibaba/fastjson.git
synced 2026-10-29 14:10:25 +08:00
add testcase for currency
This commit is contained in:
@@ -3,18 +3,28 @@ package com.alibaba.json.bvt;
|
||||
import java.util.Currency;
|
||||
import java.util.Locale;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class CurrencyTest extends TestCase {
|
||||
|
||||
public void test_0() throws Exception {
|
||||
VO vo = new VO();
|
||||
vo.setValue(Currency.getInstance(Locale.CHINA));
|
||||
String text = JSON.toJSONString(vo);
|
||||
System.out.println(text);
|
||||
JSON.parseObject(text, VO.class);
|
||||
VO vo2 = JSON.parseObject(text, VO.class);
|
||||
Assert.assertEquals(vo2.value, vo.value);
|
||||
}
|
||||
|
||||
public void test_null() throws Exception {
|
||||
VO vo = new VO();
|
||||
vo.setValue(null);
|
||||
String text = JSON.toJSONString(vo);
|
||||
VO vo2 = JSON.parseObject(text, VO.class);
|
||||
Assert.assertEquals(vo2.value, vo.value);
|
||||
}
|
||||
|
||||
public static class VO {
|
||||
|
||||
Reference in New Issue
Block a user