@Test
public void should_error_on_invalid_class_update() throws Exception {
// Given
boolean exceptionRaised = false;
Long id = RandomUtils.nextLong(0,Long.MAX_VALUE);
EntityWithClassLevelConstraint entity = new EntityWithClassLevelConstraint();
entity.setId(id);
entity.setFirstname("fn");
entity.setLastname("ln");
StringBuilder errorMessage = new StringBuilder("Bean validation error : \n");
errorMessage.append("\tfirstname and lastname should not be blank for class '");
errorMessage.append(EntityWithClassLevelConstraint.class.getCanonicalName()).append("'");
EntityWithClassLevelConstraint managedEntity = manager.insert(entity);
try {
// When
managedEntity.setFirstname(null);
manager.update(managedEntity);
} catch (AchillesBeanValidationException ex) {
// Then
assertThat(ex.getMessage()).contains(errorMessage.toString());
exceptionRaised = true;