Skip to content

Commit

Permalink
add testcase for issue #1646
Browse files Browse the repository at this point in the history
  • Loading branch information
wenshao committed Jul 15, 2023
1 parent ddd58a7 commit 4bbe14a
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.alibaba.fastjson2.issues_1600;

import com.alibaba.fastjson2.JSONObject;
import com.alibaba.fastjson2.JSONReader;
import org.junit.jupiter.api.Test;

import java.util.Map;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class Issue1646 {
@Test
public void test() {
String s = "{\"test\":{null:\"a\",\"b\":\"c\"}}";
Bean bean = (Bean) JSONObject.parseObject(s, Bean.class, JSONReader.Feature.AllowUnQuotedFieldNames);
assertEquals("a", bean.getTest().get("null"));
}

public class Bean {
private Map<String, String> test;
public Map<String, String> getTest() {
return test;
}

public void setTest(Map<String, String> test) {
this.test = test;
}
}
}

0 comments on commit 4bbe14a

Please sign in to comment.