Skip to content

Commit 27e7a05

Browse files
committed
Add failing test for #2627
1 parent 458541d commit 27e7a05

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.fasterxml.jackson.failing;
2+
3+
import java.io.IOException;
4+
5+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
6+
7+
import com.fasterxml.jackson.databind.*;
8+
9+
public class IgnoreUnknownOnField2627Test extends BaseMapTest
10+
{
11+
// [databind#2627]
12+
13+
@JsonIgnoreProperties(ignoreUnknown = true)
14+
static class MyPojoValue {
15+
@JsonIgnoreProperties(ignoreUnknown = true)
16+
MyPojo2627 value;
17+
18+
public MyPojo2627 getValue() {
19+
return value;
20+
}
21+
}
22+
23+
static class MyPojo2627 {
24+
public String name;
25+
}
26+
27+
// [databind#2627]
28+
public void testFieldIgnoral() throws IOException
29+
{
30+
ObjectMapper objectMapper = new ObjectMapper();
31+
String json = "{\"value\": {\"name\": \"my_name\", \"extra\": \"val\"}, \"type\":\"Json\"}";
32+
MyPojoValue value = objectMapper.readValue(json, MyPojoValue.class);
33+
assertNotNull(value);
34+
assertNotNull(value.getValue());
35+
assertEquals("my_name", value.getValue().name);
36+
}
37+
38+
}

0 commit comments

Comments
 (0)