Search in sources :

Example 51 with Drug

use of org.openmrs.Drug in project openmrs-core by openmrs.

the class HibernateConceptDAOTest method getDrugs_shouldReturnDrugIfPhraseMatchDrugNameNoNeedToMatchBothConceptNameAndDrugName.

/**
 * @see HibernateConceptDAO#getDrugs(String,Concept,boolean,boolean,boolean,Integer,Integer)
 */
@Test
public void getDrugs_shouldReturnDrugIfPhraseMatchDrugNameNoNeedToMatchBothConceptNameAndDrugName() {
    // This concept does not contain concept_name with "Triomune"
    Concept concept2 = dao.getConcept(3);
    // In this test there is no any concept_name match with "Triomune" but
    // Drug name match with "Trimonue" so no need to match both drug_name
    // and the concept_name to find drug
    List<Drug> drugList = dao.getDrugs("Triomune", concept2, true, true, false, 0, 10);
    Assert.assertEquals(1, drugList.size());
}
Also used : Concept(org.openmrs.Concept) Drug(org.openmrs.Drug) Test(org.junit.Test) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest)

Example 52 with Drug

use of org.openmrs.Drug in project openmrs-core by openmrs.

the class HibernateConceptDAOTest method getDrugs_shouldReturnDrugIfPhaseMatchConceptNameNoNeedToMatchBothConceptNameAndDrugName.

/**
 * @see HibernateConceptDAO#getDrugs(String,Concept,boolean,boolean,boolean,Integer,Integer)
 */
@Test
public void getDrugs_shouldReturnDrugIfPhaseMatchConceptNameNoNeedToMatchBothConceptNameAndDrugName() {
    Concept concept4 = dao.getConcept(7);
    // In this test, there is no any drug_name with "VOIDED" but concept_name
    // match with "VOIDED" so this prove no need to match both drug_name and the
    // concept_name
    List<Drug> drugList = dao.getDrugs("VOIDED", concept4, true, true, false, 0, 10);
    Assert.assertEquals(1, drugList.size());
}
Also used : Concept(org.openmrs.Concept) Drug(org.openmrs.Drug) Test(org.junit.Test) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest)

Aggregations

Drug (org.openmrs.Drug)52 Test (org.junit.Test)47 BaseContextSensitiveTest (org.openmrs.test.BaseContextSensitiveTest)41 Concept (org.openmrs.Concept)16 BindException (org.springframework.validation.BindException)15 Errors (org.springframework.validation.Errors)14 DrugReferenceMap (org.openmrs.DrugReferenceMap)9 ConceptMapType (org.openmrs.ConceptMapType)8 DrugOrder (org.openmrs.DrugOrder)7 OrderUtilTest (org.openmrs.order.OrderUtilTest)7 ConceptSource (org.openmrs.ConceptSource)6 ArrayList (java.util.ArrayList)5 Date (java.util.Date)5 ConceptReferenceTerm (org.openmrs.ConceptReferenceTerm)3 Obs (org.openmrs.Obs)3 HashSet (java.util.HashSet)2 ConceptAnswer (org.openmrs.ConceptAnswer)2 ConceptDatatype (org.openmrs.ConceptDatatype)2 ConceptName (org.openmrs.ConceptName)2 Encounter (org.openmrs.Encounter)2