Skip to content

Commit

Permalink
improved for guava multimap support, for issue #2132
Browse files Browse the repository at this point in the history
  • Loading branch information
wenshao committed Nov 18, 2018
1 parent a444e7f commit 38f46a3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,7 @@ private ObjectSerializer getObjectWriter(Class<?> clazz, boolean create) {
String[] names = new String[] {
"com.google.common.collect.HashMultimap",
"com.google.common.collect.LinkedListMultimap",
"com.google.common.collect.LinkedHashMultimap",
"com.google.common.collect.ArrayListMultimap",
"com.google.common.collect.TreeMultimap"
};
Expand Down
16 changes: 16 additions & 0 deletions src/test/java/com/alibaba/json/bvt/issue_2100/Issue2129.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.alibaba.json.bvt.issue_2100;

import com.alibaba.fastjson.JSON;
import com.google.common.collect.LinkedHashMultimap;
import junit.framework.TestCase;

public class Issue2129 extends TestCase {
public void test_for_issue() throws Exception {
LinkedHashMultimap<String, String> map = LinkedHashMultimap.create();
map.put("a", "1");
map.put("a", "b");
map.put("b", "1");
String json = JSON.toJSONString(map);
assertEquals("{\"a\":[\"1\",\"b\"],\"b\":[\"1\"]}", json);
}
}

0 comments on commit 38f46a3

Please sign in to comment.