Method
@Override
public PatientProgram unvoidPatientProgram(PatientProgram patientProgram) {
Date voidDate = patientProgram.getDateVoided();
patientProgram.setVoided(false);
for (PatientState state : patientProgram.getStates()) {
if (voidDate != null && voidDate.equals(state.getDateVoided())) {
state.setVoided(false);
state.setVoidedBy(null);
state.setDateVoided(null);
state.setVoidReason(null);
}
}
return Context.getProgramWorkflowService().savePatientProgram(patientProgram); // The savePatientProgram method handles all of the unvoiding defaults
}
of class org.openmrs.api.impl.ProgramWorkflowServiceImpl empties all the ‘voided’ fields in patientState but does not empty voidedBy, dateVoided and voidReason in patientProgram.
How can I know if that is correct? Is there some kind of specification I could consult in order to write the right test?