Search in sources :

Example 21 with EncounterRole

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

the class EncounterRoleValidatorTest method validate_shouldPassEditingEncounterRoleName.

/**
 * {@link org.openmrs.validator.EncounterRoleValidator#validate(Object, org.springframework.validation.Errors)}
 */
@Test
public void validate_shouldPassEditingEncounterRoleName() {
    EncounterRole encounterRole = Context.getEncounterService().getEncounterRoleByName("Unknown");
    Assert.assertNotNull(encounterRole);
    encounterRole.setName("Lab");
    encounterRole.setDescription("desc");
    Errors errors = new BindException(encounterRole, "encounterRole");
    new EncounterRoleValidator().validate(encounterRole, errors);
    Assert.assertFalse(errors.hasErrors());
}
Also used : Errors(org.springframework.validation.Errors) EncounterRole(org.openmrs.EncounterRole) BindException(org.springframework.validation.BindException) Test(org.junit.Test) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest)

Example 22 with EncounterRole

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

the class RequireNameValidatorTest method validate_shouldPassValidationIfNameHasProperValue.

/**
 * @see RequireNameValidator#validate(Object,Errors)
 */
@Test
public void validate_shouldPassValidationIfNameHasProperValue() {
    EncounterRole role = new EncounterRole();
    role.setName("restraining");
    Errors errors = new BindException(role, "type");
    new RequireNameValidator().validate(role, errors);
    Assert.assertFalse(errors.hasErrors());
}
Also used : Errors(org.springframework.validation.Errors) EncounterRole(org.openmrs.EncounterRole) BindException(org.springframework.validation.BindException) Test(org.junit.Test)

Aggregations

EncounterRole (org.openmrs.EncounterRole)22 Test (org.junit.Test)20 BaseContextSensitiveTest (org.openmrs.test.BaseContextSensitiveTest)17 EncounterType (org.openmrs.EncounterType)7 Provider (org.openmrs.Provider)7 BindException (org.springframework.validation.BindException)7 Errors (org.springframework.validation.Errors)7 Date (java.util.Date)6 Encounter (org.openmrs.Encounter)6 Location (org.openmrs.Location)6 Patient (org.openmrs.Patient)4 EncounterProvider (org.openmrs.EncounterProvider)2 SimpleObject (org.openmrs.ui.framework.SimpleObject)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 User (org.openmrs.User)1 Visit (org.openmrs.Visit)1 AdministrationService (org.openmrs.api.AdministrationService)1 EncounterService (org.openmrs.api.EncounterService)1 AppContextModel (org.openmrs.module.appframework.context.AppContextModel)1