BeanValidator validator = new BeanValidator();
validator.setErrorCodeConverter(new DefaultErrorCodeConverter());
validator.setConfigurationLoader(loader);
Person person = new Person("Uri");
BindException errors = new BindException(person, "person");
validator.validate(person, errors);
assertTrue(errors.hasFieldErrors("name"));
assertTrue(errors.hasGlobalErrors());
assertEquals(1, errors.getFieldErrorCount("name"));
assertEquals(1, errors.getGlobalErrorCount());
assertEquals("Person[minLength]", errors.getGlobalError().getCode());
assertEquals("Person.name[minLength]", errors.getFieldError("name").getCode());
}