use of org.openmrs.ConceptMap in project openmrs-core by openmrs.
the class ConceptServiceTest method saveConcept_shouldCreateAReferenceTermForAConceptMappingOnTheFlyWhenEditingAConcept.
/**
* @see ConceptService#saveConcept(Concept)
*/
@Test
public void saveConcept_shouldCreateAReferenceTermForAConceptMappingOnTheFlyWhenEditingAConcept() {
int initialTermCount = conceptService.getAllConceptReferenceTerms().size();
Concept concept = conceptService.getConcept(5497);
ConceptMap map = new ConceptMap();
map.getConceptReferenceTerm().setCode("unique code");
map.getConceptReferenceTerm().setConceptSource(conceptService.getConceptSource(1));
concept.addConceptMapping(map);
conceptService.saveConcept(concept);
Assert.assertEquals(initialTermCount + 1, conceptService.getAllConceptReferenceTerms().size());
}
use of org.openmrs.ConceptMap in project openmrs-core by openmrs.
the class ConceptServiceTest method saveConcept_shouldCreateAReferenceTermForAConceptMappingOnTheFlyWhenCreatingAConcept.
/**
* @see ConceptService#saveConcept(Concept)
*/
@Test
public void saveConcept_shouldCreateAReferenceTermForAConceptMappingOnTheFlyWhenCreatingAConcept() {
int initialTermCount = conceptService.getAllConceptReferenceTerms().size();
Concept concept = new Concept();
concept.addName(new ConceptName("test name", Context.getLocale()));
concept.setDatatype(new ConceptDatatype(1));
concept.setConceptClass(new ConceptClass(1));
ConceptMap map = new ConceptMap();
map.getConceptReferenceTerm().setCode("unique code");
map.getConceptReferenceTerm().setConceptSource(conceptService.getConceptSource(1));
concept.addDescription(new ConceptDescription("some description", null));
concept.addConceptMapping(map);
conceptService.saveConcept(concept);
Assert.assertNotNull(concept.getId());
Assert.assertEquals(initialTermCount + 1, conceptService.getAllConceptReferenceTerms().size());
}
Aggregations