use of org.openmrs.Concept in project openmrs-core by openmrs.
the class ConceptServiceTest method getConceptByUuid_shouldFindObjectGivenValidUuid.
/**
* @see ConceptService#getConceptByUuid(String)
*/
@Test
public void getConceptByUuid_shouldFindObjectGivenValidUuid() {
String uuid = "0cbe2ed3-cd5f-4f46-9459-26127c9265ab";
Concept concept = Context.getConceptService().getConceptByUuid(uuid);
Assert.assertEquals(3, (int) concept.getConceptId());
}
use of org.openmrs.Concept in project openmrs-core by openmrs.
the class ConceptServiceTest method saveConcept_shouldPassWhenSavingAConceptAfterRemovingAName.
/**
* @see ConceptService#saveConcept(Concept)
*/
@Test
public void saveConcept_shouldPassWhenSavingAConceptAfterRemovingAName() {
executeDataSet("org/openmrs/api/include/ConceptServiceTest-names.xml");
Concept concept = conceptService.getConcept(3000);
concept.addDescription(new ConceptDescription("some description", null));
Assert.assertFalse(concept.getSynonyms().isEmpty());
concept.removeName(concept.getSynonyms().iterator().next());
conceptService.saveConcept(concept);
}
use of org.openmrs.Concept in project openmrs-core by openmrs.
the class ConceptServiceTest method changeConceptFromBooleanToCoded_shouldConvertTheDatatypeOfABooleanConceptToCoded.
/**
* @see ConceptService#getConceptDatatypeByName(String)
*/
@Test
public void changeConceptFromBooleanToCoded_shouldConvertTheDatatypeOfABooleanConceptToCoded() {
Concept concept = conceptService.getConcept(18);
Assert.assertEquals(conceptService.getConceptDatatypeByName("Boolean").getConceptDatatypeId(), concept.getDatatype().getConceptDatatypeId());
conceptService.convertBooleanConceptToCoded(concept);
Assert.assertEquals(conceptService.getConceptDatatypeByName("Coded").getConceptDatatypeId(), concept.getDatatype().getConceptDatatypeId());
}
use of org.openmrs.Concept in project openmrs-core by openmrs.
the class ConceptServiceTest method getConceptByMapping_shouldIgnoreCase.
/**
* @see ConceptService#getConceptByMapping(String,String)
*/
@Test
public void getConceptByMapping_shouldIgnoreCase() {
Concept concept = conceptService.getConceptByMapping("wgt234", "sstrm");
Assert.assertEquals(5089, concept.getId().intValue());
}
use of org.openmrs.Concept in project openmrs-core by openmrs.
the class ConceptServiceTest method mapConceptProposalToConcept_shouldFailWhenAddingADuplicateSyonymn.
/**
* @see ConceptService#mapConceptProposalToConcept(ConceptProposal,Concept,Locale)
*/
@Test(expected = DuplicateConceptNameException.class)
public void mapConceptProposalToConcept_shouldFailWhenAddingADuplicateSyonymn() {
executeDataSet("org/openmrs/api/include/ConceptServiceTest-proposals.xml");
ConceptService cs = Context.getConceptService();
ConceptProposal cp = cs.getConceptProposal(10);
cp.setFinalText(cp.getOriginalText());
cp.setState(OpenmrsConstants.CONCEPT_PROPOSAL_SYNONYM);
Concept mappedConcept = cs.getConcept(5);
Locale locale = new Locale("en", "GB");
mappedConcept.addDescription(new ConceptDescription("some description", locale));
Assert.assertTrue(mappedConcept.hasName(cp.getFinalText(), locale));
cs.mapConceptProposalToConcept(cp, mappedConcept, locale);
}
Aggregations