Search in sources :

Example 6 with DiagnosisMetadata

use of org.openmrs.module.emrapi.diagnosis.DiagnosisMetadata 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

DiagnosisMetadata (org.openmrs.module.emrapi.diagnosis.DiagnosisMetadata)6 Obs (org.openmrs.Obs)4 Test (org.junit.Test)3 Diagnosis (org.openmrs.module.emrapi.diagnosis.Diagnosis)3 Date (java.util.Date)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)2 ArrayNode (org.codehaus.jackson.node.ArrayNode)2 ObjectNode (org.codehaus.jackson.node.ObjectNode)2 TestUiUtils (org.openmrs.module.appui.TestUiUtils)2 CodedOrFreeTextAnswer (org.openmrs.module.emrapi.diagnosis.CodedOrFreeTextAnswer)2 RegressionTestHelper (org.openmrs.module.htmlformentry.RegressionTestHelper)2 BaseModuleWebContextSensitiveTest (org.openmrs.web.test.BaseModuleWebContextSensitiveTest)2 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)2 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Matcher (org.hamcrest.Matcher)1