@Test
public void should_error_on_invalid_field_update() throws Exception {
// Given
boolean exceptionRaised = false;
Long id = RandomUtils.nextLong(0,Long.MAX_VALUE);
EntityWithFieldLevelConstraint entity = new EntityWithFieldLevelConstraint();
entity.setId(id);
entity.setName("name");
StringBuilder errorMessage = new StringBuilder("Bean validation error : \n");
errorMessage.append("\tproperty 'name' of class '");
errorMessage.append(EntityWithFieldLevelConstraint.class.getCanonicalName()).append("'");
EntityWithFieldLevelConstraint managedEntity = manager.insert(entity);
try {
// When
managedEntity.setName(null);
manager.update(managedEntity);
} catch (AchillesBeanValidationException ex) {
// Then
assertThat(ex.getMessage()).contains(errorMessage.toString());