JsonHelper { public static <T> Update<T> update(String json, Class<T> klazz) { try { JavaType type = MAPPER.getTypeFactory().constructParametricType(Update.class, klazz); return MAPPER.readValue(json, type); } catch (Exception e) { throw new RuntimeException(e); } }  static T obj(String json, Class<T> klazz); static T object(String json, Class<T> klazz); static Update<T> update(String json, Class<T> klazz); static String json(Object object); static ObjectMapper MAPPER; }
@Test public void testUpdate() throws Exception { Update<TestModel> update = JsonHelper.update("{'name':'Ian','active':true,email:null}", TestModel.class); assertTrue(update.getPartial().getActive()); assertTrue(update.getRemoveFields().contains("email")); }