Search in sources :

Example 11 with ConceptProposal

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

the class ConceptServiceTest method mapConceptProposalToConcept_shouldAllowRejectingProposals.

/**
 * @see ConceptService#mapConceptProposalToConcept(ConceptProposal,Concept)
 */
@Test
public void mapConceptProposalToConcept_shouldAllowRejectingProposals() {
    String uuid = "af4ae460-0e2b-11e0-a94b-469c3c5a0c2f";
    ConceptProposal proposal = Context.getConceptService().getConceptProposalByUuid(uuid);
    Assert.assertNotNull("could not find proposal " + uuid, proposal);
    // because there is a  different unit test for the case when mapped proposal is null, we use a non-null concept here for our testing
    Concept concept = conceptService.getConcept(3);
    Assert.assertNotNull("could not find target concept to use for the test", concept);
    proposal.setState(OpenmrsConstants.CONCEPT_PROPOSAL_REJECT);
    Context.getConceptService().mapConceptProposalToConcept(proposal, concept);
    // retrieve the proposal from the model and check its new state
    ConceptProposal persisted = Context.getConceptService().getConceptProposalByUuid(uuid);
    Assert.assertEquals(OpenmrsConstants.CONCEPT_PROPOSAL_REJECT, persisted.getState());
}
Also used : OpenmrsMatchers.hasConcept(org.openmrs.test.OpenmrsMatchers.hasConcept) Concept(org.openmrs.Concept) ConceptProposal(org.openmrs.ConceptProposal) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest) Test(org.junit.Test)

Aggregations

ConceptProposal (org.openmrs.ConceptProposal)11 Test (org.junit.Test)9 BaseContextSensitiveTest (org.openmrs.test.BaseContextSensitiveTest)9 Concept (org.openmrs.Concept)5 Obs (org.openmrs.Obs)4 OpenmrsMatchers.hasConcept (org.openmrs.test.OpenmrsMatchers.hasConcept)4 Locale (java.util.Locale)2 ConceptDescription (org.openmrs.ConceptDescription)2 Patient (org.openmrs.Patient)2 HL7Exception (ca.uhn.hl7v2.HL7Exception)1 ApplicationException (ca.uhn.hl7v2.app.ApplicationException)1 DataTypeException (ca.uhn.hl7v2.model.DataTypeException)1 Message (ca.uhn.hl7v2.model.Message)1 FT (ca.uhn.hl7v2.model.v25.datatype.FT)1 ORU_R01_ORDER_OBSERVATION (ca.uhn.hl7v2.model.v25.group.ORU_R01_ORDER_OBSERVATION)1 ORU_R01_PATIENT_RESULT (ca.uhn.hl7v2.model.v25.group.ORU_R01_PATIENT_RESULT)1 MSH (ca.uhn.hl7v2.model.v25.segment.MSH)1 NK1 (ca.uhn.hl7v2.model.v25.segment.NK1)1 OBR (ca.uhn.hl7v2.model.v25.segment.OBR)1 OBX (ca.uhn.hl7v2.model.v25.segment.OBX)1