-
-
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
f609683
commit 152f855
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
src/test/java/com/fasterxml/jackson/failing/AnySetter349Test.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,49 @@ | ||
package com.fasterxml.jackson.failing; | ||
|
||
import java.util.*; | ||
|
||
import com.fasterxml.jackson.annotation.*; | ||
|
||
import com.fasterxml.jackson.databind.*; | ||
|
||
// test(s) for [databind#349] | ||
public class AnySetter349Test extends BaseMapTest | ||
{ | ||
static class Bean349 | ||
{ | ||
public String type; | ||
|
||
private Map<String, Object> props = new HashMap<>(); | ||
|
||
@JsonAnySetter | ||
public void addProperty(String key, Object value) { | ||
props.put(key, value); | ||
} | ||
|
||
@JsonAnyGetter | ||
public Map<String, Object> getProperties() { | ||
return props; | ||
} | ||
|
||
@JsonUnwrapped | ||
public IdentityDTO349 identity = null; | ||
} | ||
|
||
static class IdentityDTO349 { | ||
public int x, y; | ||
} | ||
|
||
public void testUnwrappedWithAny() throws Exception | ||
{ | ||
final ObjectMapper mapper = objectMapper(); | ||
final String json = aposToQuotes( | ||
"{ 'type' : 'IST',\n" | ||
+" 'spacename' : 'Foo Models',\n" | ||
+" 'name' : 'BLAH-New',\n" | ||
+" 'description' : 'namespace.name: X THIN FIR.DR-WD12-New',\n" | ||
+" 'ZoomLinks': [ 'foofoofoofoo', 'barbarbarbar' ] }" | ||
); | ||
Bean349 value = mapper.readValue(json, Bean349.class); | ||
assertNotNull(value); | ||
} | ||
} |