package com.alibaba.json.bvt;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializeConfig;
import junit.framework.TestCase;

import java.util.Currency;

public class CurrencyTest5 extends TestCase {

    public void test_0() throws Exception {
        SerializeConfig config = new SerializeConfig();
        config.put(Currency.class
                , config.createJavaBeanSerializer(Currency.class));

        JSONObject jsonObject = new JSONObject();
        jsonObject.put("value", Currency.getInstance("CNY"));

        String text = JSON.toJSONString(jsonObject, config);
        System.out.println(text);
        String str1 = "{\"value\":{\"currencyCode\":\"CNY\",\"displayName\":\"Chinese Yuan\",\"symbol\":\"CNY\"}}";
        String str2 = "{\"value\":{\"currencyCode\":\"CNY\",\"displayName\":\"人民币\",\"symbol\":\"￥\"}}";
        String str3 = "{\"value\":{\"currencyCode\":\"CNY\",\"displayName\":\"Chinese Yuan\",\"numericCodeAsString\":\"156\",\"symbol\":\"CN¥\"}}";
        assertTrue(text.equals(str1)
                || text.equals(str2)
                || text.equals(str3));

        Currency currency = JSON.parseObject(text, VO.class).value;

        assertSame(Currency.getInstance("CNY"), currency);
    }

    public static class VO {
        public Currency value;

    }
}

@@ -1039,24 +1039,161 @@
 %5C%22CN%C2%A5%5C%22%7D%7D%22;%0A
+        String str4 = %22%7B%5C%22value%5C%22:%7B%5C%22currencyCode%5C%22:%5C%22CNY%5C%22,%5C%22displayName%5C%22:%5C%22%E4%BA%BA%E6%B0%91%E5%B8%81%5C%22,%5C%22numericCodeAsString%5C%22:%5C%22156%5C%22,%5C%22symbol%5C%22:%5C%22%EF%BF%A5%5C%22%7D%7D%22;%0A
         asse
@@ -1290,16 +1290,53 @@
 ls(str3)
+%0A                %7C%7C text.equals(str4)
 );%0A%0A    

Update CurrencyTest5.java