use of org.openmrs.ConceptStateConversion in project openmrs-core by openmrs.
the class StateConversionValidatorTest method validate_shouldFailValidationIfConceptIsNullOrEmptyOrWhitespace.
/**
* @see StateConversionValidator#validate(Object,Errors)
*/
@Test
public void validate_shouldFailValidationIfConceptIsNullOrEmptyOrWhitespace() {
ConceptStateConversion csc = new ConceptStateConversion();
ProgramWorkflow workflow = Context.getProgramWorkflowService().getProgram(1).getAllWorkflows().iterator().next();
csc.setProgramWorkflow(workflow);
csc.setProgramWorkflowState(workflow.getState(1));
Errors errors = new BindException(csc, "csc");
new StateConversionValidator().validate(csc, errors);
Assert.assertTrue(errors.hasFieldErrors("concept"));
}
use of org.openmrs.ConceptStateConversion in project openmrs-core by openmrs.
the class StateConversionValidatorTest method validate_shouldPassValidationIfAllRequiredFieldsHaveProperValues.
/**
* @see StateConversionValidator#validate(Object,Errors)
*/
@Test
public void validate_shouldPassValidationIfAllRequiredFieldsHaveProperValues() {
ConceptStateConversion csc = new ConceptStateConversion();
ProgramWorkflow workflow = Context.getProgramWorkflowService().getProgram(1).getAllWorkflows().iterator().next();
csc.setConcept(Context.getConceptService().getConcept(3));
csc.setProgramWorkflow(workflow);
csc.setProgramWorkflowState(workflow.getState(1));
Errors errors = new BindException(csc, "csc");
new StateConversionValidator().validate(csc, errors);
Assert.assertFalse(errors.hasErrors());
}
Aggregations