Search in sources :

Example 16 with Diagnosis

use of org.openmrs.module.emrapi.diagnosis.Diagnosis in project openmrs-module-coreapps by openmrs.

the class EncounterDiagnosesElementTest method testGenerateHtml.

@Test
public void testGenerateHtml() throws Exception {
    EmrApiProperties emrApiProperties = mock(EmrApiProperties.class);
    FormEntryContext context = mock(FormEntryContext.class);
    when(context.getMode()).thenReturn(FormEntryContext.Mode.VIEW);
    EncounterDiagnosesElement element = new EncounterDiagnosesElement() {

        @Override
        List<Diagnosis> getExistingDiagnoses(FormEntryContext context, DiagnosisMetadata diagnosisMetadata) {
            return Arrays.asList(new Diagnosis(new CodedOrFreeTextAnswer("Some disease")));
        }
    };
    element.setEmrApiProperties(emrApiProperties);
    String html = element.generateHtml(context);
    assertTrue(html.indexOf("Translated") >= 0);
}
Also used : DiagnosisMetadata(org.openmrs.module.emrapi.diagnosis.DiagnosisMetadata) EmrApiProperties(org.openmrs.module.emrapi.EmrApiProperties) FormEntryContext(org.openmrs.module.htmlformentry.FormEntryContext) Diagnosis(org.openmrs.module.emrapi.diagnosis.Diagnosis) CodedOrFreeTextAnswer(org.openmrs.module.emrapi.diagnosis.CodedOrFreeTextAnswer) Matchers.anyString(org.mockito.Matchers.anyString) BaseContextMockTest(org.openmrs.test.BaseContextMockTest) Test(org.junit.Test)

Aggregations

Diagnosis (org.openmrs.module.emrapi.diagnosis.Diagnosis)16 ArrayList (java.util.ArrayList)8 CodedOrFreeTextAnswer (org.openmrs.module.emrapi.diagnosis.CodedOrFreeTextAnswer)8 Obs (org.openmrs.Obs)7 Test (org.junit.Test)5 List (java.util.List)4 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)4 JsonNode (org.codehaus.jackson.JsonNode)3 Concept (org.openmrs.Concept)3 TestUiUtils (org.openmrs.module.appui.TestUiUtils)3 DiagnosisMetadata (org.openmrs.module.emrapi.diagnosis.DiagnosisMetadata)3 SimpleObject (org.openmrs.ui.framework.SimpleObject)3 HashMap (java.util.HashMap)2 ConceptName (org.openmrs.ConceptName)2 Patient (org.openmrs.Patient)2 FragmentModel (org.openmrs.ui.framework.fragment.FragmentModel)2 IOException (java.io.IOException)1 Calendar (java.util.Calendar)1 Date (java.util.Date)1 HashSet (java.util.HashSet)1