assertTrue("Same global error in list", globalError.getDefaultMessage().equals(globalErrorInAllList.getDefaultMessage()));
assertTrue("Correct field errors flag", errors.hasFieldErrors());
assertTrue("Correct number of field errors", errors.getFieldErrorCount() == 3);
assertTrue("Correct number of field errors in list", errors.getFieldErrors().size() == 3);
FieldError fieldError = errors.getFieldError();
assertTrue("Field error code not escaped", "NAME_EMPTY &".equals(fieldError.getCode()));
assertTrue("Field value escaped", "empty &".equals(errors.getFieldValue("name")));
FieldError fieldErrorInList = (FieldError) errors.getFieldErrors().get(0);
assertTrue("Same field error in list", fieldError.getDefaultMessage().equals(fieldErrorInList.getDefaultMessage()));
assertTrue("Correct name errors flag", errors.hasFieldErrors("name"));
assertTrue("Correct number of name errors", errors.getFieldErrorCount("name") == 1);
assertTrue("Correct number of name errors in list", errors.getFieldErrors("name").size() == 1);
FieldError nameError = errors.getFieldError("name");
assertTrue("Name error message escaped", "message: &".equals(nameError.getDefaultMessage()));
assertTrue("Name error code not escaped", "NAME_EMPTY &".equals(nameError.getCode()));
assertTrue("Name value escaped", "empty &".equals(errors.getFieldValue("name")));
FieldError nameErrorInList = (FieldError) errors.getFieldErrors("name").get(0);
assertTrue("Same name error in list", nameError.getDefaultMessage().equals(nameErrorInList.getDefaultMessage()));
assertTrue("Correct age errors flag", errors.hasFieldErrors("age"));
assertTrue("Correct number of age errors", errors.getFieldErrorCount("age") == 2);
assertTrue("Correct number of age errors in list", errors.getFieldErrors("age").size() == 2);
FieldError ageError = errors.getFieldError("age");
assertTrue("Age error message escaped", "message: <tag>".equals(ageError.getDefaultMessage()));
assertTrue("Age error code not escaped", "AGE_NOT_SET <tag>".equals(ageError.getCode()));
assertTrue("Age value not escaped", (new Integer(0)).equals(errors.getFieldValue("age")));
FieldError ageErrorInList = (FieldError) errors.getFieldErrors("age").get(0);
assertTrue("Same name error in list", ageError.getDefaultMessage().equals(ageErrorInList.getDefaultMessage()));
FieldError ageError2 = (FieldError) errors.getFieldErrors("age").get(1);
assertTrue("Age error 2 message escaped", "message: <tag>".equals(ageError2.getDefaultMessage()));
assertTrue("Age error 2 code not escaped", "AGE_NOT_32 <tag>".equals(ageError2.getCode()));
}