File tree 1 file changed +35
-0
lines changed
src/test/java/com/fasterxml/jackson/databind/ser/jdk
1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .databind .ser .jdk ;
2
+
3
+ import java .util .Collections ;
4
+ import java .util .Map ;
5
+
6
+ import com .fasterxml .jackson .annotation .JsonValue ;
7
+ import com .fasterxml .jackson .databind .*;
8
+
9
+ public class MapKeySerialization2306Test extends BaseMapTest
10
+ {
11
+ static class JsonValue2306Key {
12
+ @ JsonValue
13
+ private String id ;
14
+
15
+ public JsonValue2306Key (String id ) {
16
+ this .id = id ;
17
+ }
18
+ }
19
+
20
+ /*
21
+ /**********************************************************************
22
+ /* Test methods
23
+ /**********************************************************************
24
+ */
25
+
26
+ private final ObjectMapper MAPPER = newJsonMapper ();
27
+
28
+ public void testMapKeyWithJsonValue () throws Exception
29
+ {
30
+ final Map <JsonValue2306Key , String > map = Collections .singletonMap (
31
+ new JsonValue2306Key ("myId" ), "value" );
32
+ assertEquals (aposToQuotes ("{'myId':'value'}" ),
33
+ MAPPER .writeValueAsString (map ));
34
+ }
35
+ }
You can’t perform that action at this time.
0 commit comments