/** @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()); }
/** * Get dicom viewer URL for given study and patient * * @param study study for the dicom viewer url * @param patient patient for the dicom viewer url * @should return dicom viewer url given completed study and patient * @should return null given non completed study and patient */ private String getDicomViewerUrl(Study study, Patient patient) { if (study.isCompleted()) { String studyUidUrl = "studyUID=" + study.getStudyInstanceUid(); String patientIdUrl = "patientID=" + patient.getPatientIdentifier().getIdentifier(); return RadiologyProperties.getDicomViewerUrl() + studyUidUrl + "&" + patientIdUrl; } else { return null; } }
/** @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)); }