-
-
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
458541d
commit 27e7a05
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
src/test/java/com/fasterxml/jackson/failing/IgnoreUnknownOnField2627Test.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,38 @@ | ||
package com.fasterxml.jackson.failing; | ||
|
||
import java.io.IOException; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
|
||
import com.fasterxml.jackson.databind.*; | ||
|
||
public class IgnoreUnknownOnField2627Test extends BaseMapTest | ||
{ | ||
// [databind#2627] | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
static class MyPojoValue { | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
MyPojo2627 value; | ||
|
||
public MyPojo2627 getValue() { | ||
return value; | ||
} | ||
} | ||
|
||
static class MyPojo2627 { | ||
public String name; | ||
} | ||
|
||
// [databind#2627] | ||
public void testFieldIgnoral() throws IOException | ||
{ | ||
ObjectMapper objectMapper = new ObjectMapper(); | ||
String json = "{\"value\": {\"name\": \"my_name\", \"extra\": \"val\"}, \"type\":\"Json\"}"; | ||
MyPojoValue value = objectMapper.readValue(json, MyPojoValue.class); | ||
assertNotNull(value); | ||
assertNotNull(value.getValue()); | ||
assertEquals("my_name", value.getValue().name); | ||
} | ||
|
||
} |