-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a test to show that #2306 was already implemented
- Loading branch information
1 parent
7f24ec5
commit 791bf2b
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
src/test/java/com/fasterxml/jackson/databind/ser/jdk/MapKeySerialization2306Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.fasterxml.jackson.databind.ser.jdk; | ||
|
||
import java.util.Collections; | ||
import java.util.Map; | ||
|
||
import com.fasterxml.jackson.annotation.JsonValue; | ||
import com.fasterxml.jackson.databind.*; | ||
|
||
public class MapKeySerialization2306Test extends BaseMapTest | ||
{ | ||
static class JsonValue2306Key { | ||
@JsonValue | ||
private String id; | ||
|
||
public JsonValue2306Key(String id) { | ||
this.id = id; | ||
} | ||
} | ||
|
||
/* | ||
/********************************************************************** | ||
/* Test methods | ||
/********************************************************************** | ||
*/ | ||
|
||
private final ObjectMapper MAPPER = newJsonMapper(); | ||
|
||
public void testMapKeyWithJsonValue() throws Exception | ||
{ | ||
final Map<JsonValue2306Key, String> map = Collections.singletonMap( | ||
new JsonValue2306Key("myId"), "value"); | ||
assertEquals(aposToQuotes("{'myId':'value'}"), | ||
MAPPER.writeValueAsString(map)); | ||
} | ||
} |