use of org.openmrs.ConceptAnswer in project openmrs-core by openmrs.
the class ConceptServiceTest method changeConceptFromBooleanToCoded_shouldExplicitlyAddFalseConceptAsAValue_CodedAnswer.
/**
* @see ConceptService#convertBooleanConceptToCoded(Concept)
*/
@Test
public void changeConceptFromBooleanToCoded_shouldExplicitlyAddFalseConceptAsAValue_CodedAnswer() {
Concept concept = conceptService.getConcept(18);
Collection<ConceptAnswer> answers = concept.getAnswers(false);
boolean falseConceptFound = false;
// initially the concept shouldn't present
for (ConceptAnswer conceptAnswer : answers) {
if (conceptAnswer.getAnswerConcept().equals(conceptService.getFalseConcept())) {
falseConceptFound = true;
}
}
Assert.assertEquals(false, falseConceptFound);
conceptService.convertBooleanConceptToCoded(concept);
answers = concept.getAnswers(false);
for (ConceptAnswer conceptAnswer : answers) {
if (conceptAnswer.getAnswerConcept().equals(conceptService.getFalseConcept())) {
falseConceptFound = true;
}
}
Assert.assertEquals(true, falseConceptFound);
}
use of org.openmrs.ConceptAnswer in project openmrs-core by openmrs.
the class ConceptServiceTest method changeConceptFromBooleanToCoded_shouldExplicitlyAddTrueConceptAsAValue_CodedAnswer.
/**
* @see ConceptService#convertBooleanConceptToCoded(Concept)
*/
@Test
public void changeConceptFromBooleanToCoded_shouldExplicitlyAddTrueConceptAsAValue_CodedAnswer() {
Concept concept = conceptService.getConcept(18);
Collection<ConceptAnswer> answers = concept.getAnswers(false);
boolean trueConceptFound = false;
for (ConceptAnswer conceptAnswer : answers) {
if (conceptAnswer.getAnswerConcept().equals(conceptService.getTrueConcept())) {
trueConceptFound = true;
}
}
Assert.assertEquals(false, trueConceptFound);
conceptService.convertBooleanConceptToCoded(concept);
answers = concept.getAnswers(false);
for (ConceptAnswer conceptAnswer : answers) {
if (conceptAnswer.getAnswerConcept().equals(conceptService.getTrueConcept())) {
trueConceptFound = true;
}
}
Assert.assertEquals(true, trueConceptFound);
}
Aggregations