@Test
public void testMultipleMessages() {
String message1 = "message1";
String message2 = "message2";
ConstraintValidatorContextImpl context = createEmptyConstraintValidatorContextImpl();
context.buildConstraintViolationWithTemplate( message1 )
.addPropertyNode( "foo" )
.addPropertyNode( "bar" ).inIterable().atKey( "key" )
.addConstraintViolation();
context.buildConstraintViolationWithTemplate( message2 )
.addConstraintViolation();
List<ConstraintViolationCreationContext> constraintViolationCreationContextList = context.getConstraintViolationCreationContexts();
assertTrue( constraintViolationCreationContextList.size() == 2 );
assertMessageAndPath( constraintViolationCreationContextList.get( 0 ), message1, "foo[key].bar" );
assertMessageAndPath( constraintViolationCreationContextList.get( 1 ), message2, "" );
}