-
-
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.
- Loading branch information
Showing
3 changed files
with
69 additions
and
16 deletions.
There are no files selected for viewing
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
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
31 changes: 31 additions & 0 deletions
31
src/test/java/com/fasterxml/jackson/databind/exc/ExceptionWithAnySetter4316Test.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,31 @@ | ||
package com.fasterxml.jackson.databind.exc; | ||
|
||
import java.util.*; | ||
|
||
import com.fasterxml.jackson.annotation.JsonAnyGetter; | ||
import com.fasterxml.jackson.annotation.JsonAnySetter; | ||
import com.fasterxml.jackson.databind.*; | ||
|
||
public class ExceptionWithAnySetter4316Test extends BaseMapTest | ||
{ | ||
static class Problem extends Exception { | ||
private static final long serialVersionUID = 1L; | ||
|
||
@JsonAnySetter | ||
@JsonAnyGetter | ||
Map<String, Object> additionalProperties = new HashMap<>(); | ||
} | ||
|
||
private final ObjectMapper MAPPER = newJsonMapper(); | ||
|
||
// [databind#4316] | ||
public void testWithAnySetter() throws Exception | ||
{ | ||
Problem problem = new Problem(); | ||
problem.additionalProperties.put("key", "value"); | ||
String json = MAPPER.writeValueAsString(problem); | ||
Problem result = MAPPER.readValue(json, Problem.class); | ||
assertEquals(Collections.singletonMap("key", "value"), | ||
result.additionalProperties); | ||
} | ||
} |