Search in sources :

Example 96 with Concept

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());
}
Also used : OpenmrsMatchers.hasConcept(org.openmrs.test.OpenmrsMatchers.hasConcept) Concept(org.openmrs.Concept) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest) Test(org.junit.Test)

Example 97 with Concept

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);
}
Also used : OpenmrsMatchers.hasConcept(org.openmrs.test.OpenmrsMatchers.hasConcept) Concept(org.openmrs.Concept) ConceptDescription(org.openmrs.ConceptDescription) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest) Test(org.junit.Test)

Example 98 with 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());
}
Also used : OpenmrsMatchers.hasConcept(org.openmrs.test.OpenmrsMatchers.hasConcept) Concept(org.openmrs.Concept) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest) Test(org.junit.Test)

Example 99 with Concept

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());
}
Also used : OpenmrsMatchers.hasConcept(org.openmrs.test.OpenmrsMatchers.hasConcept) Concept(org.openmrs.Concept) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest) Test(org.junit.Test)

Example 100 with Concept

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);
}
Also used : OpenmrsMatchers.hasConcept(org.openmrs.test.OpenmrsMatchers.hasConcept) Concept(org.openmrs.Concept) Locale(java.util.Locale) ConceptProposal(org.openmrs.ConceptProposal) ConceptDescription(org.openmrs.ConceptDescription) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest) Test(org.junit.Test)

Aggregations

Concept (org.openmrs.Concept)294 Test (org.junit.Test)210 BaseContextSensitiveTest (org.openmrs.test.BaseContextSensitiveTest)176 ConceptName (org.openmrs.ConceptName)62 OpenmrsMatchers.hasConcept (org.openmrs.test.OpenmrsMatchers.hasConcept)62 Obs (org.openmrs.Obs)49 Date (java.util.Date)48 Patient (org.openmrs.Patient)42 ConceptDescription (org.openmrs.ConceptDescription)33 Locale (java.util.Locale)32 ConceptDatatype (org.openmrs.ConceptDatatype)32 OrderUtilTest (org.openmrs.order.OrderUtilTest)29 ConceptClass (org.openmrs.ConceptClass)27 ArrayList (java.util.ArrayList)26 BindException (org.springframework.validation.BindException)26 DrugOrder (org.openmrs.DrugOrder)25 Encounter (org.openmrs.Encounter)25 Errors (org.springframework.validation.Errors)25 ConceptMapBuilder (org.openmrs.module.metadatadeploy.builder.ConceptMapBuilder)21 Location (org.openmrs.Location)19