-
-
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
1 parent
b7ed073
commit 9087057
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/test/java/com/fasterxml/jackson/failing/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.failing; | ||
|
||
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); | ||
} | ||
} |