-
Notifications
You must be signed in to change notification settings - Fork 14
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
3aa4b12
commit 4c87d57
Showing
4 changed files
with
44 additions
and
0 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
33 changes: 33 additions & 0 deletions
33
src/test/java/com/fasterxml/jackson/datatype/jsr353/DeserViaCreatorTest.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,33 @@ | ||
package com.fasterxml.jackson.datatype.jsr353; | ||
|
||
import javax.json.JsonObject; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
|
||
public class DeserViaCreatorTest extends TestBase | ||
{ | ||
static class Pojo { | ||
String text; | ||
JsonObject object; | ||
|
||
@JsonCreator | ||
public Pojo(@JsonProperty("s") String s, @JsonProperty("o") JsonObject o) { | ||
text = s; | ||
object = o; | ||
} | ||
} | ||
|
||
public void testCreatorDeser() throws Exception | ||
{ | ||
final ObjectMapper mapper = new ObjectMapper() | ||
.registerModule(MODULE); | ||
Pojo p = mapper.readerFor(Pojo.class) | ||
.readValue( "{\"s\": \"String\", \"o\": { \"a\": 1, \"b\": \"2\" } }"); | ||
assertNotNull(p); | ||
|
||
p = mapper.readerFor(Pojo.class).readValue("{\"s\": \"String\"}"); | ||
assertNotNull(p); | ||
} | ||
} |
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