-
-
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.
fix @JsonUnwrapped for fields with property based creator
- Loading branch information
Showing
6 changed files
with
124 additions
and
35 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
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
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
42 changes: 42 additions & 0 deletions
42
...va/com/fasterxml/jackson/databind/struct/UnwrappedPropertyBasedCreatorWithPrefixTest.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,42 @@ | ||
package com.fasterxml.jackson.databind.struct; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.annotation.JsonUnwrapped; | ||
import com.fasterxml.jackson.databind.BaseMapTest; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
|
||
public class UnwrappedPropertyBasedCreatorWithPrefixTest extends BaseMapTest | ||
{ | ||
static class Outer { | ||
@JsonUnwrapped(prefix = "inner-") | ||
Inner inner; | ||
} | ||
|
||
static class Inner { | ||
private final String _property; | ||
|
||
public Inner(@JsonProperty("property") String property) { | ||
_property = property; | ||
} | ||
|
||
public String getProperty() { | ||
return _property; | ||
} | ||
} | ||
|
||
/* | ||
/********************************************************** | ||
/* Tests, deserialization | ||
/********************************************************** | ||
*/ | ||
|
||
private final ObjectMapper MAPPER = newJsonMapper(); | ||
|
||
public void testUnwrappedWithJsonCreatorWithExplicitWithoutName() throws Exception | ||
{ | ||
String json = "{\"inner-property\": \"value\"}"; | ||
Outer outer = MAPPER.readValue(json, Outer.class); | ||
|
||
assertEquals("value", outer.inner.getProperty()); | ||
} | ||
} |