diff --git a/bahmnicore-api/src/test/java/org/bahmni/module/bahmnicore/service/impl/PatientDocumentServiceImplTest.java b/bahmnicore-api/src/test/java/org/bahmni/module/bahmnicore/service/impl/PatientDocumentServiceImplTest.java index 33dde7917..c1611333b 100644 --- a/bahmnicore-api/src/test/java/org/bahmni/module/bahmnicore/service/impl/PatientDocumentServiceImplTest.java +++ b/bahmnicore-api/src/test/java/org/bahmni/module/bahmnicore/service/impl/PatientDocumentServiceImplTest.java @@ -7,6 +7,7 @@ import org.bahmni.module.bahmnicore.model.VideoFormats; import org.bahmni.module.bahmnicore.properties.BahmniCoreProperties; import org.bahmni.module.bahmnicore.service.ThumbnailGenerator; +import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -15,10 +16,13 @@ import org.mockito.Matchers; import org.mockito.Mock; import org.openmrs.Patient; +import org.openmrs.api.context.UserContext; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.springframework.http.ResponseEntity; +import org.openmrs.api.AdministrationService; +import org.openmrs.api.context.Context; import javax.imageio.ImageIO; import java.awt.image.BufferedImage; @@ -39,9 +43,10 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import static org.powermock.api.mockito.PowerMockito.verifyStatic; +import static org.mockito.MockitoAnnotations.initMocks; @RunWith(PowerMockRunner.class) -@PrepareForTest({BahmniCoreProperties.class, FileInputStream.class, FileUtils.class, ImageIO.class}) +@PrepareForTest({BahmniCoreProperties.class, FileInputStream.class, FileUtils.class, ImageIO.class, Context.class}) public class PatientDocumentServiceImplTest { private PatientDocumentServiceImpl patientDocumentService; @@ -54,6 +59,18 @@ public class PatientDocumentServiceImplTest { @Mock ThumbnailGenerator thumbnailGenerator; + @Mock + private AdministrationService administrationService; + + @Mock + private UserContext userContext; + + @Before + public void setUp() { + initMocks(this); + PowerMockito.mockStatic(Context.class); + when(Context.getAdministrationService()).thenReturn(administrationService); + } @Test public void shouldCreateRightDirectoryAccordingToPatientId() { @@ -176,7 +193,7 @@ public void shouldThrowExceptionWhenImageTypeOtherThanPngJpegGif() throws Except patientDocumentService = new PatientDocumentServiceImpl(); patientDocumentService.saveDocument(1, "Consultation", "otherfileContent", "bmp", "image", "file-name"); } - + @Test public void shouldCreateThumbnailForVideo() throws Exception { PowerMockito.mockStatic(BahmniCoreProperties.class); diff --git a/bahmnicore-omod/src/test/java/org/bahmni/module/bahmnicore/web/v1_0/controller/BahmniPatientProfileResourceTest.java b/bahmnicore-omod/src/test/java/org/bahmni/module/bahmnicore/web/v1_0/controller/BahmniPatientProfileResourceTest.java index 337059894..2c3267b43 100644 --- a/bahmnicore-omod/src/test/java/org/bahmni/module/bahmnicore/web/v1_0/controller/BahmniPatientProfileResourceTest.java +++ b/bahmnicore-omod/src/test/java/org/bahmni/module/bahmnicore/web/v1_0/controller/BahmniPatientProfileResourceTest.java @@ -93,6 +93,7 @@ public void setUp() throws IOException { PowerMockito.when(Context.getService(RestService.class)).thenReturn(restService); PowerMockito.when(Context.getPersonService()).thenReturn(personService); PowerMockito.when(Context.getMessageSourceService()).thenReturn(messageSourceService); + PowerMockito.when(Context.getAdministrationService()).thenReturn(administrationService); PowerMockito.when(restService.getResourceBySupportedClass(Patient.class)).thenReturn(patientResource1_8); PowerMockito.when(patientResource1_8.getPatient(any(SimpleObject.class))).thenReturn(patient); PowerMockito.when(patientResource1_8.getPatientForUpdate(anyString(), any(SimpleObject.class))).thenReturn(patient); @@ -106,7 +107,6 @@ public void createPatient() throws Exception { when(identifierSourceServiceWrapper.generateIdentifierUsingIdentifierSourceUuid("dead-cafe", "")).thenReturn("BAH300010"); doReturn(delegate).when(bahmniPatientProfileResourceSpy, "mapForCreatePatient", propertiesToCreate); when(emrPatientProfileService.save(delegate)).thenReturn(delegate); - when(Context.getAdministrationService()).thenReturn(administrationService); when(Context.getPatientService()).thenReturn(patientService); Patient patient = mock(Patient.class); when(patient.getUuid()).thenReturn("patientUuid"); diff --git a/pom.xml b/pom.xml index 8f16b17f7..28710b360 100644 --- a/pom.xml +++ b/pom.xml @@ -46,30 +46,31 @@ UTF-8 2.5.12 - 2.39.0 + 2.44.0 5.2.14.RELEASE 1.10.1 - 2.14.2 - 1.23.0 + 2.17.0 + 1.26.0 1.3.0 0.2.15 - 1.35.0-SNAPSHOT - 1.5.0 + 1.36.0 + 1.6.0 2.6.3 1.18.20 - 4.7.0 - 1.13.0 + 4.10.0 + 1.16.0 1.1.0 1.3.0 1.3.0 1.0.0 - 0.94.4-SNAPSHOT + 1.0.0 4.0.1 2.17.1 1.4.0 - 2.13.0 + 2.14.0 1.6.2 - 1.1.0-SNAPSHOT + 1.1.0 + 1.2.0 4.13 @@ -579,7 +580,7 @@ org.bahmni.module communication-api - 1.2.0-SNAPSHOT + ${communicationVersion} jar provided