/** @see RadiologyObsFormController#getDicomViewerUrl(Study, Patient) */ @Test @Verifies( value = "should return null given non completed study and patient", method = "getDicomViewerUrl(Study, Patient)") public void getDicomViewerUrl_ShouldReturnNullGivenNonCompletedStudyAndPatient() throws Exception { mockStudy.setPerformedStatus(PerformedProcedureStepStatus.IN_PROGRESS); when(RadiologyProperties.getServersAddress()).thenReturn("localhost"); when(RadiologyProperties.getServersPort()).thenReturn("8081"); when(RadiologyProperties.getDicomViewerUrlBase()).thenReturn("/weasis/viewer?"); Method getDicomViewerUrlMethod = radiologyObsFormController .getClass() .getDeclaredMethod( "getDicomViewerUrl", new Class[] {org.openmrs.module.radiology.Study.class, org.openmrs.Patient.class}); getDicomViewerUrlMethod.setAccessible(true); String dicomViewerUrl = (String) getDicomViewerUrlMethod.invoke( radiologyObsFormController, new Object[] {mockStudy, mockPatient}); assertThat(dicomViewerUrl, nullValue()); }
/** @see RadiologyObsFormController#getDicomViewerUrl(Study, Patient) */ @Test @Verifies( value = "should return dicom viewer url given completed study and patient", method = "getDicomViewerUrl(Study, Patient)") public void getDicomViewerUrl_ShouldReturnDicomViewerUrlGivenCompletedStudyAndPatient() throws Exception { mockStudy.setPerformedStatus(PerformedProcedureStepStatus.COMPLETED); when(RadiologyProperties.getServersAddress()).thenReturn("localhost"); when(RadiologyProperties.getServersPort()).thenReturn("8081"); when(RadiologyProperties.getDicomViewerUrlBase()).thenReturn("/weasis/viewer?"); Method getDicomViewerUrlMethod = radiologyObsFormController .getClass() .getDeclaredMethod( "getDicomViewerUrl", new Class[] {org.openmrs.module.radiology.Study.class, org.openmrs.Patient.class}); getDicomViewerUrlMethod.setAccessible(true); String dicomViewerUrl = (String) getDicomViewerUrlMethod.invoke( radiologyObsFormController, new Object[] {mockStudy, mockPatient}); assertNotNull(dicomViewerUrl); String patID = mockPatient.getPatientIdentifier().getIdentifier(); assertThat( dicomViewerUrl, is( "http://localhost:8081/weasis/viewer?studyUID=" + mockStudy.getStudyInstanceUid() + "&patientID=" + patID)); }