Search in sources :

Example 16 with LocationAttributeType

use of org.openmrs.LocationAttributeType in project openmrs-core by openmrs.

the class LocationAttributeTypeValidatorTest method validate_shouldPassValidationIfAllRequiredFieldsHaveProperValues.

/**
 * @see LocationAttributeTypeValidator#validate(Object,Errors)
 */
@Test
public void validate_shouldPassValidationIfAllRequiredFieldsHaveProperValues() {
    LocationAttributeType type = new LocationAttributeType();
    type.setName("name");
    type.setDatatypeClassname("org.openmrs.customdatatype.datatype.FreeTextDatatype");
    Errors errors = new BindException(type, "type");
    new LocationAttributeTypeValidator().validate(type, errors);
    Assert.assertFalse(errors.hasErrors());
}
Also used : Errors(org.springframework.validation.Errors) BindException(org.springframework.validation.BindException) LocationAttributeType(org.openmrs.LocationAttributeType) Test(org.junit.Test) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest)

Aggregations

LocationAttributeType (org.openmrs.LocationAttributeType)16 Test (org.junit.Test)13 BaseContextSensitiveTest (org.openmrs.test.BaseContextSensitiveTest)13 BindException (org.springframework.validation.BindException)6 Errors (org.springframework.validation.Errors)6 HashMap (java.util.HashMap)2 Location (org.openmrs.Location)2 LocationAttribute (org.openmrs.LocationAttribute)2 LocationService (org.openmrs.api.LocationService)1 FreeTextDatatype (org.openmrs.customdatatype.datatype.FreeTextDatatype)1