use of org.openmrs.LocationTag in project openmrs-core by openmrs.
the class LocationTagValidatorTest method validate_shouldFailValidationIfFieldLengthsAreNotCorrect.
/**
* @see LocationTagValidator#validate(Object,Errors)
*/
@Test
public void validate_shouldFailValidationIfFieldLengthsAreNotCorrect() {
LocationTag locationTag = new LocationTag();
locationTag.setName("too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text");
locationTag.setDescription("too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text");
locationTag.setRetireReason("too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text");
Errors errors = new BindException(locationTag, "location");
new LocationTagValidator().validate(locationTag, errors);
Assert.assertTrue(errors.hasFieldErrors("name"));
Assert.assertTrue(errors.hasFieldErrors("description"));
Assert.assertTrue(errors.hasFieldErrors("retireReason"));
}
Aggregations