use of org.openmrs.ConceptSource in project openmrs-core by openmrs.
the class ConceptServiceTest method getDrugsByMapping_shouldMatchOnTheMapTypes.
/**
* @see ConceptService#getDrugsByMapping(String, ConceptSource, Collection, boolean)
*/
@Test
public void getDrugsByMapping_shouldMatchOnTheMapTypes() {
executeDataSet(GET_DRUG_MAPPINGS);
List<ConceptMapType> conceptMapTypeList = conceptService.getConceptMapTypes(false, true);
ConceptSource source = conceptService.getConceptSource(1);
List<Drug> drugs = conceptService.getDrugsByMapping(null, source, conceptMapTypeList, false);
assertEquals(2, drugs.size());
assertTrue(containsId(drugs, 2));
assertTrue(containsId(drugs, 3));
drugs = conceptService.getDrugsByMapping(null, source, conceptMapTypeList, true);
assertEquals(3, drugs.size());
assertTrue(containsId(drugs, 2));
assertTrue(containsId(drugs, 3));
assertTrue(containsId(drugs, 11));
}
use of org.openmrs.ConceptSource in project openmrs-core by openmrs.
the class ConceptServiceTest method getConceptSourceByName_shouldGetConceptSourceWithTheGivenName.
@Test
public void getConceptSourceByName_shouldGetConceptSourceWithTheGivenName() {
ConceptSource conceptSource = conceptService.getConceptSourceByName("SNOMED CT");
assertEquals("Method did not retrieve ConceptSource by name", Integer.valueOf(2), conceptSource.getConceptSourceId());
}
use of org.openmrs.ConceptSource in project openmrs-core by openmrs.
the class ConceptServiceTest method getDrugsByMapping_shouldMatchOnTheCode.
/**
* @see ConceptService#getDrugsByMapping(String, ConceptSource, Collection, boolean)
*/
@Test
public void getDrugsByMapping_shouldMatchOnTheCode() {
executeDataSet(GET_DRUG_MAPPINGS);
ConceptSource source = conceptService.getConceptSource(1);
List<Drug> drugs = conceptService.getDrugsByMapping("WGT234", source, null, false);
assertEquals(1, drugs.size());
assertTrue(containsId(drugs, 2));
}
use of org.openmrs.ConceptSource in project openmrs-core by openmrs.
the class ConceptServiceTest method getConceptSourceByHL7Code_shouldGetConceptSourceWithTheGivenUniqueId.
/**
* @see ConceptService#getConceptSourceByHL7Code(String)
*/
@Test
public void getConceptSourceByHL7Code_shouldGetConceptSourceWithTheGivenUniqueId() {
String existinghl7Code = "SCT";
ConceptSource conceptSource = conceptService.getConceptSourceByHL7Code(existinghl7Code);
assertThat(conceptSource, is(not(nullValue())));
assertThat(conceptSource.getHl7Code(), is(existinghl7Code));
}
use of org.openmrs.ConceptSource in project openmrs-core by openmrs.
the class ConceptServiceTest method saveConceptSource_shouldNotSetCreatorIfOneIsSuppliedAlready.
/**
* @see ConceptService#saveConceptSource(ConceptSource)
*/
@Test
public void saveConceptSource_shouldNotSetCreatorIfOneIsSuppliedAlready() {
// a user that isn't logged in now
User expectedCreator = new User(501);
ConceptSource newConceptSource = new ConceptSource();
newConceptSource.setName("name");
newConceptSource.setDescription("desc");
newConceptSource.setHl7Code("hl7Code");
newConceptSource.setCreator(expectedCreator);
Context.getConceptService().saveConceptSource(newConceptSource);
Assert.assertEquals(newConceptSource.getCreator(), expectedCreator);
}
Aggregations