mirror of
https://github.com/alibaba/fastjson.git
synced 2026-10-24 18:47:08 +08:00
bugfix
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
package com.alibaba.json.bvt.bug;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
|
||||
public class Bug_for_ruiqi extends TestCase {
|
||||
|
||||
public void test_0() throws Exception {
|
||||
Map<String, Enum> map = new HashMap<String, Enum>();
|
||||
map.put("a", Enum.ENUM1);
|
||||
map.put("b", Enum.ENUM1);
|
||||
|
||||
System.out.println(JSON.toJSONString(map, SerializerFeature.WriteEnumUsingToString));
|
||||
|
||||
System.out.println(JSON.toJSONString(map));
|
||||
|
||||
}
|
||||
|
||||
public static enum Enum {
|
||||
|
||||
ENUM1("name1"), ENUM2("name2");
|
||||
|
||||
private String name;
|
||||
|
||||
Enum(String name){
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "name: " + name;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user