Skip to content

Commit 791bf2b

Browse files
committed
Add a test to show that #2306 was already implemented
1 parent 7f24ec5 commit 791bf2b

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
}

0 commit comments

Comments
 (0)