GeodeJsonMapper { public static ObjectMapper getMapperIgnoringUnknownProperties() { ObjectMapper mapper = new ObjectMapper(); mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); mapper.configure(MapperFeature.USE_BASE_TYPE_AS_DEFAULT_IMPL, true); mapper.configure(FAIL_ON_UNKNOWN_PROPERTIES, false); mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY); return mapper; }  static ObjectMapper getMapper(); static ObjectMapper getMapperIgnoringUnknownProperties();  }
@Test public void ignoreUnknownPropMapper() throws Exception { ObjectMapper mapper = GeodeJsonMapper.getMapperIgnoringUnknownProperties(); String json = "{\"name\":\"Joe\"}"; Employee employee = new Employee(); employee.setName("Joe"); assertThat(mapper.writeValueAsString(employee)).isEqualTo(json); String jsonWithUnknownProp = "{\"name\":\"Joe\",\"id\":\"test\"}"; employee = mapper.readValue(jsonWithUnknownProp, Employee.class); assertThat(employee.getName()).isEqualTo("Joe"); assertThat(employee.getTitle()).isNull(); }