Skip to content

Commit

Permalink
Add a test to show that #2306 was already implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Oct 10, 2019
1 parent 7f24ec5 commit 791bf2b
Showing 1 changed file with 35 additions and 0 deletions.
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));
}
}

0 comments on commit 791bf2b

Please sign in to comment.