Skip to content

Commit

Permalink
Add failing test for #2627
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Mar 25, 2020
1 parent 458541d commit 27e7a05
Showing 1 changed file with 38 additions and 0 deletions.
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);
}

}

0 comments on commit 27e7a05

Please sign in to comment.