### Question:
ModelValidator { public boolean validateUpdate(Update<?> update, FieldData fieldData) { List<ValidationError> errors = getUpdateValidationErrors(update, fieldData); if (!errors.isEmpty()) { throw new DataValidationException(errors); } return true; } ModelValidator(Validator validator, ObjectMapper mapper); List<ValidationError> getModelValidationErrors(Object object, Class validationGroup); List<ValidationError> getCreateValidationErrors(Object create, FieldData fieldData); List<ValidationError> getUpdateValidationErrors(Update<?> update, FieldData fieldData); boolean validateModel(Object model); boolean validateCreate(Object create, FieldData fieldData); boolean validateUpdate(Update<?> update, FieldData fieldData);  }### Answer:
@Test public void testValidateUpdate() throws Exception { try { validator.validateUpdate(JsonHelper.update("{email:'bad'}", TestValidateModel.class), fieldData); fail("Expected DataValidationException"); } catch (DataValidationException e) { assertEquals(1, e.getErrors().size()); } assertTrue(validator.validateUpdate(JsonHelper.update("{email:'ok@example.com'}", TestValidateModel.class), fieldData)); }