diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index ae2a0adc..4d755e05 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -15,7 +15,7 @@ jobs:
strategy:
matrix:
platform: [ ubuntu-latest ]
- java-version: [ 8 ]
+ java-version: [ 8, 11, 17, 21 ]
runs-on: ${{ matrix.platform }}
env:
diff --git a/api/pom.xml b/api/pom.xml
index ab54aa91..8aba752e 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -3,7 +3,7 @@
org.openmrs.module
queue
- 2.10.0-SNAPSHOT
+ 3.0.0-SNAPSHOT
queue-api
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 5a8539d7..997ec548 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -3,7 +3,7 @@
org.openmrs.module
queue
- 2.10.0-SNAPSHOT
+ 3.0.0-SNAPSHOT
queue-integration-tests
diff --git a/omod/pom.xml b/omod/pom.xml
index 0297254f..e6202907 100644
--- a/omod/pom.xml
+++ b/omod/pom.xml
@@ -3,7 +3,7 @@
org.openmrs.module
queue
- 2.10.0-SNAPSHOT
+ 3.0.0-SNAPSHOT
queue-omod
@@ -122,8 +122,8 @@
${project.parent.groupId}
${project.parent.artifactId}-api
- true
- **/*
+ compile
+ **\/*.xml,**\/*.properties
${project.build.directory}/classes
diff --git a/omod/src/main/resources/config.xml b/omod/src/main/resources/config.xml
index cfbf1bb5..7541fc1a 100644
--- a/omod/src/main/resources/config.xml
+++ b/omod/src/main/resources/config.xml
@@ -23,7 +23,7 @@
${project.parent.groupId}.${project.parent.artifactId}.QueueModuleActivator
- 2.3.0
+ ${openmrsPlatformVersion}
org.openmrs.module.webservices.rest
diff --git a/omod/src/test/java/org/openmrs/module/queue/web/QueueEntryMetricRestControllerTest.java b/omod/src/test/java/org/openmrs/module/queue/web/QueueEntryMetricRestControllerTest.java
index 951fae07..71a176e5 100644
--- a/omod/src/test/java/org/openmrs/module/queue/web/QueueEntryMetricRestControllerTest.java
+++ b/omod/src/test/java/org/openmrs/module/queue/web/QueueEntryMetricRestControllerTest.java
@@ -14,12 +14,13 @@
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasSize;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.lenient;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.mockStatic;
import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import static org.openmrs.module.queue.web.QueueEntryMetricRestController.COUNT;
import static org.openmrs.module.queue.web.resources.parser.QueueEntrySearchCriteriaParser.SEARCH_PARAM_STATUS;
-import static org.powermock.api.mockito.PowerMockito.mock;
-import static org.powermock.api.mockito.PowerMockito.mockStatic;
-import static org.powermock.api.mockito.PowerMockito.when;
import javax.servlet.http.HttpServletRequest;
@@ -29,11 +30,14 @@
import java.util.List;
import java.util.Map;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
+import org.mockito.MockedStatic;
+import org.mockito.junit.jupiter.MockitoExtension;
import org.openmrs.Concept;
import org.openmrs.api.ConceptService;
import org.openmrs.api.LocationService;
@@ -48,11 +52,8 @@
import org.openmrs.module.queue.web.resources.parser.QueueEntrySearchCriteriaParser;
import org.openmrs.module.webservices.rest.SimpleObject;
import org.openmrs.module.webservices.rest.web.RestUtil;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({ Context.class, RestUtil.class })
+@ExtendWith(MockitoExtension.class)
public class QueueEntryMetricRestControllerTest {
private QueueEntryMetricRestController controller;
@@ -81,32 +82,36 @@ public class QueueEntryMetricRestControllerTest {
@Mock
private QueueServicesWrapper queueServicesWrapper;
+ private MockedStatic restUtil;
+
+ private MockedStatic context;
+
HttpServletRequest request;
Map parameterMap;
ArgumentCaptor queueEntryArgumentCaptor;
- @Before
+ @BeforeEach
public void prepareMocks() {
- mockStatic(RestUtil.class);
- mockStatic(Context.class);
- when(queueServicesWrapper.getQueueService()).thenReturn(queueService);
- when(queueServicesWrapper.getQueueEntryService()).thenReturn(queueEntryService);
- when(queueServicesWrapper.getQueueRoomService()).thenReturn(queueRoomService);
- when(queueServicesWrapper.getRoomProviderMapService()).thenReturn(roomProviderMapService);
- when(queueServicesWrapper.getConceptService()).thenReturn(conceptService);
- when(queueServicesWrapper.getLocationService()).thenReturn(locationService);
- when(queueServicesWrapper.getPatientService()).thenReturn(patientService);
+ restUtil = mockStatic(RestUtil.class);
+ context = mockStatic(Context.class);
+ lenient().when(queueServicesWrapper.getQueueService()).thenReturn(queueService);
+ lenient().when(queueServicesWrapper.getQueueEntryService()).thenReturn(queueEntryService);
+ lenient().when(queueServicesWrapper.getQueueRoomService()).thenReturn(queueRoomService);
+ lenient().when(queueServicesWrapper.getRoomProviderMapService()).thenReturn(roomProviderMapService);
+ lenient().when(queueServicesWrapper.getConceptService()).thenReturn(conceptService);
+ lenient().when(queueServicesWrapper.getLocationService()).thenReturn(locationService);
+ lenient().when(queueServicesWrapper.getPatientService()).thenReturn(patientService);
//By pass authentication
- when(Context.isAuthenticated()).thenReturn(true);
+ context.when(Context::isAuthenticated).thenReturn(true);
QueueEntrySearchCriteriaParser searchCriteriaParser = new QueueEntrySearchCriteriaParser(queueServicesWrapper);
- when(Context.getRegisteredComponents(QueueEntrySearchCriteriaParser.class))
+ context.when(() -> Context.getRegisteredComponents(QueueEntrySearchCriteriaParser.class))
.thenReturn(Collections.singletonList(searchCriteriaParser));
- when(Context.getRegisteredComponents(QueueServicesWrapper.class))
+ context.when(() -> Context.getRegisteredComponents(QueueServicesWrapper.class))
.thenReturn(Collections.singletonList(queueServicesWrapper));
controller = new QueueEntryMetricRestController(searchCriteriaParser, queueServicesWrapper);
@@ -118,6 +123,12 @@ public void prepareMocks() {
when(queueEntryService.getCountOfQueueEntries(any())).thenReturn(50L);
}
+ @AfterEach
+ public void cleanup() {
+ restUtil.close();
+ context.close();
+ }
+
@Test
public void shouldRetrieveCountOfQueueEntriesByStatus() {
List vals = Arrays.asList(new Concept(), new Concept());
diff --git a/omod/src/test/java/org/openmrs/module/queue/web/resources/BaseQueueResourceTest.java b/omod/src/test/java/org/openmrs/module/queue/web/resources/BaseQueueResourceTest.java
index 9d60264b..d23a28c8 100644
--- a/omod/src/test/java/org/openmrs/module/queue/web/resources/BaseQueueResourceTest.java
+++ b/omod/src/test/java/org/openmrs/module/queue/web/resources/BaseQueueResourceTest.java
@@ -13,12 +13,14 @@
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.hasKey;
import static org.hamcrest.Matchers.notNullValue;
-import static org.mockito.Mockito.when;
+import static org.mockito.Mockito.mockStatic;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
-import org.junit.Before;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.mockito.MockedStatic;
import org.openmrs.OpenmrsObject;
import org.openmrs.api.context.Context;
import org.openmrs.module.webservices.rest.web.RestUtil;
@@ -26,12 +28,9 @@
import org.openmrs.module.webservices.rest.web.representation.FullRepresentation;
import org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceDescription;
import org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceHandler;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
@Getter(AccessLevel.PACKAGE)
@Setter(AccessLevel.PACKAGE)
-@PrepareForTest({ Context.class, RestUtil.class })
public class BaseQueueResourceTest> {
private O resource;
@@ -40,13 +39,26 @@ public class BaseQueueResourceTest restUtil;
+
+ @Getter(AccessLevel.PACKAGE)
+ @Setter(AccessLevel.PACKAGE)
+ private MockedStatic context;
+
+ @BeforeEach
public void prepareMocks() {
- PowerMockito.mockStatic(RestUtil.class);
-
- PowerMockito.mockStatic(Context.class);
+ restUtil = mockStatic(RestUtil.class);
+ context = mockStatic(Context.class);
//By pass authentication
- when(Context.isAuthenticated()).thenReturn(true);
+ context.when(Context::isAuthenticated).thenReturn(true);
+ }
+
+ @AfterEach
+ public void cleanup() {
+ restUtil.close();
+ context.close();
}
public void verifyDefaultRepresentation(String... properties) {
diff --git a/omod/src/test/java/org/openmrs/module/queue/web/resources/QueueEntryResourceTest.java b/omod/src/test/java/org/openmrs/module/queue/web/resources/QueueEntryResourceTest.java
index 21f5cfcd..4b51bcc4 100644
--- a/omod/src/test/java/org/openmrs/module/queue/web/resources/QueueEntryResourceTest.java
+++ b/omod/src/test/java/org/openmrs/module/queue/web/resources/QueueEntryResourceTest.java
@@ -16,7 +16,11 @@
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
+import static org.mockito.Mockito.lenient;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.mockStatic;
import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import static org.openmrs.module.queue.web.resources.parser.QueueEntrySearchCriteriaParser.SEARCH_PARAM_ENDED_ON_OR_AFTER;
import static org.openmrs.module.queue.web.resources.parser.QueueEntrySearchCriteriaParser.SEARCH_PARAM_ENDED_ON_OR_BEFORE;
import static org.openmrs.module.queue.web.resources.parser.QueueEntrySearchCriteriaParser.SEARCH_PARAM_HAS_VISIT;
@@ -34,9 +38,6 @@
import static org.openmrs.module.queue.web.resources.parser.QueueEntrySearchCriteriaParser.SEARCH_PARAM_STARTED_ON_OR_BEFORE;
import static org.openmrs.module.queue.web.resources.parser.QueueEntrySearchCriteriaParser.SEARCH_PARAM_STATUS;
import static org.openmrs.module.queue.web.resources.parser.QueueEntrySearchCriteriaParser.SEARCH_PARAM_VISIT;
-import static org.powermock.api.mockito.PowerMockito.mock;
-import static org.powermock.api.mockito.PowerMockito.mockStatic;
-import static org.powermock.api.mockito.PowerMockito.when;
import javax.servlet.http.HttpServletRequest;
@@ -47,11 +48,12 @@
import java.util.Map;
import java.util.Optional;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
import org.openmrs.Concept;
import org.openmrs.Location;
import org.openmrs.Patient;
@@ -77,11 +79,8 @@
import org.openmrs.module.webservices.rest.web.representation.DefaultRepresentation;
import org.openmrs.module.webservices.rest.web.representation.FullRepresentation;
import org.openmrs.module.webservices.rest.web.representation.RefRepresentation;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({ Context.class, RestUtil.class })
+@ExtendWith(MockitoExtension.class)
public class QueueEntryResourceTest extends BaseQueueResourceTest {
private static final String QUEUE_ENTRY_UUID = "6hje567a-fca0-11e5-9e59-08002719a7";
@@ -122,26 +121,26 @@ public class QueueEntryResourceTest extends BaseQueueResourceTest queueEntryArgumentCaptor;
- @Before
+ @BeforeEach
public void prepareMocks() {
- mockStatic(RestUtil.class);
- mockStatic(Context.class);
- when(queueServicesWrapper.getQueueService()).thenReturn(queueService);
- when(queueServicesWrapper.getQueueEntryService()).thenReturn(queueEntryService);
- when(queueServicesWrapper.getQueueRoomService()).thenReturn(queueRoomService);
- when(queueServicesWrapper.getRoomProviderMapService()).thenReturn(roomProviderMapService);
- when(queueServicesWrapper.getConceptService()).thenReturn(conceptService);
- when(queueServicesWrapper.getLocationService()).thenReturn(locationService);
- when(queueServicesWrapper.getPatientService()).thenReturn(patientService);
+ setRestUtil(mockStatic(RestUtil.class));
+ setContext(mockStatic(Context.class));
+ lenient().when(queueServicesWrapper.getQueueService()).thenReturn(queueService);
+ lenient().when(queueServicesWrapper.getQueueEntryService()).thenReturn(queueEntryService);
+ lenient().when(queueServicesWrapper.getQueueRoomService()).thenReturn(queueRoomService);
+ lenient().when(queueServicesWrapper.getRoomProviderMapService()).thenReturn(roomProviderMapService);
+ lenient().when(queueServicesWrapper.getConceptService()).thenReturn(conceptService);
+ lenient().when(queueServicesWrapper.getLocationService()).thenReturn(locationService);
+ lenient().when(queueServicesWrapper.getPatientService()).thenReturn(patientService);
//By pass authentication
- when(Context.isAuthenticated()).thenReturn(true);
+ getContext().when(Context::isAuthenticated).thenReturn(true);
- when(Context.getRegisteredComponents(QueueServicesWrapper.class))
+ getContext().when(() -> Context.getRegisteredComponents(QueueServicesWrapper.class))
.thenReturn(Collections.singletonList(queueServicesWrapper));
QueueEntrySearchCriteriaParser searchCriteriaParser = new QueueEntrySearchCriteriaParser(queueServicesWrapper);
- when(Context.getRegisteredComponents(QueueEntrySearchCriteriaParser.class))
+ getContext().when(() -> Context.getRegisteredComponents(QueueEntrySearchCriteriaParser.class))
.thenReturn(Collections.singletonList(searchCriteriaParser));
resource = new QueueEntryResource();
@@ -152,9 +151,9 @@ public void prepareMocks() {
requestContext = mock(RequestContext.class);
request = mock(HttpServletRequest.class);
- when(requestContext.getRequest()).thenReturn(request);
+ lenient().when(requestContext.getRequest()).thenReturn(request);
parameterMap = new HashMap<>();
- when(request.getParameterMap()).thenReturn(parameterMap);
+ lenient().when(request.getParameterMap()).thenReturn(parameterMap);
queueEntryArgumentCaptor = ArgumentCaptor.forClass(QueueEntrySearchCriteria.class);
}
diff --git a/omod/src/test/java/org/openmrs/module/queue/web/resources/QueueEntrySubResourceTest.java b/omod/src/test/java/org/openmrs/module/queue/web/resources/QueueEntrySubResourceTest.java
index 2e9b322a..bfe2b87a 100644
--- a/omod/src/test/java/org/openmrs/module/queue/web/resources/QueueEntrySubResourceTest.java
+++ b/omod/src/test/java/org/openmrs/module/queue/web/resources/QueueEntrySubResourceTest.java
@@ -13,16 +13,18 @@
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
-import static org.powermock.api.mockito.PowerMockito.mock;
-import static org.powermock.api.mockito.PowerMockito.when;
+import static org.mockito.Mockito.lenient;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
import java.util.Collections;
import java.util.Optional;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
import org.openmrs.api.ConceptService;
import org.openmrs.api.LocationService;
import org.openmrs.api.PatientService;
@@ -37,9 +39,8 @@
import org.openmrs.module.webservices.rest.web.representation.DefaultRepresentation;
import org.openmrs.module.webservices.rest.web.representation.FullRepresentation;
import org.openmrs.module.webservices.rest.web.representation.RefRepresentation;
-import org.powermock.modules.junit4.PowerMockRunner;
-@RunWith(PowerMockRunner.class)
+@ExtendWith(MockitoExtension.class)
public class QueueEntrySubResourceTest extends BaseQueueResourceTest {
private static final String QUEUE_ENTRY_UUID = "6hje567a-fca0-11e5-9e59-08002719a7";
@@ -70,20 +71,21 @@ public class QueueEntrySubResourceTest extends BaseQueueResourceTest Context.getRegisteredComponents(QueueServicesWrapper.class))
.thenReturn(Collections.singletonList(queueServicesWrapper));
this.setResource(new QueueEntrySubResource());
diff --git a/omod/src/test/java/org/openmrs/module/queue/web/resources/QueueResourceTest.java b/omod/src/test/java/org/openmrs/module/queue/web/resources/QueueResourceTest.java
index a8ef42ff..bcf573ae 100644
--- a/omod/src/test/java/org/openmrs/module/queue/web/resources/QueueResourceTest.java
+++ b/omod/src/test/java/org/openmrs/module/queue/web/resources/QueueResourceTest.java
@@ -16,11 +16,12 @@
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
+import static org.mockito.Mockito.lenient;
+import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import static org.openmrs.module.queue.web.resources.parser.QueueEntrySearchCriteriaParser.SEARCH_PARAM_LOCATION;
import static org.openmrs.module.queue.web.resources.parser.QueueEntrySearchCriteriaParser.SEARCH_PARAM_SERVICE;
-import static org.powermock.api.mockito.PowerMockito.mock;
-import static org.powermock.api.mockito.PowerMockito.when;
import javax.servlet.http.HttpServletRequest;
@@ -33,11 +34,12 @@
import java.util.Optional;
import org.hamcrest.Matchers;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
import org.openmrs.Concept;
import org.openmrs.Location;
import org.openmrs.module.queue.api.QueueService;
@@ -50,9 +52,8 @@
import org.openmrs.module.webservices.rest.web.representation.DefaultRepresentation;
import org.openmrs.module.webservices.rest.web.representation.FullRepresentation;
import org.openmrs.module.webservices.rest.web.representation.RefRepresentation;
-import org.powermock.modules.junit4.PowerMockRunner;
-@RunWith(PowerMockRunner.class)
+@ExtendWith(MockitoExtension.class)
public class QueueResourceTest extends BaseQueueResourceTest {
private static final String QUEUE_UUID = "6hje567a-fca0-11e5-9e59-08002719a7";
@@ -79,14 +80,15 @@ public class QueueResourceTest extends BaseQueueResourceTest queueSearchCriteriaCaptor;
- @Before
+ @BeforeEach
public void setup() {
+ this.cleanup();
queue = new Queue();
queue.setUuid(QUEUE_UUID);
queue.setName(QUEUE_NAME);
this.prepareMocks();
- when(queueServicesWrapper.getQueueService()).thenReturn(queueService);
+ lenient().when(queueServicesWrapper.getQueueService()).thenReturn(queueService);
QueueSearchCriteriaParser parser = new QueueSearchCriteriaParser(queueServicesWrapper);
resource = new QueueResource(queueServicesWrapper, parser);
@@ -95,9 +97,9 @@ public void setup() {
requestContext = mock(RequestContext.class);
request = mock(HttpServletRequest.class);
- when(requestContext.getRequest()).thenReturn(request);
+ lenient().when(requestContext.getRequest()).thenReturn(request);
parameterMap = new HashMap<>();
- when(request.getParameterMap()).thenReturn(parameterMap);
+ lenient().when(request.getParameterMap()).thenReturn(parameterMap);
queueSearchCriteriaCaptor = ArgumentCaptor.forClass(QueueSearchCriteria.class);
}
diff --git a/pom.xml b/pom.xml
index 2b1b6210..dd56c7a6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
org.openmrs.module
queue
- 2.10.0-SNAPSHOT
+ 3.0.0-SNAPSHOT
pom
Queue
Patient Queues
@@ -133,33 +133,23 @@
org.powermock
powermock-api-mockito
+
+ org.powermock
+ powermock-api-mockito2
+
-
-
org.mockito
- mockito-core
- 3.10.0
- test
-
-
- org.hamcrest
- hamcrest-core
- 2.2
+ mockito-inline
+ ${mockitoInlineVersion}
test
- org.powermock
- powermock-module-junit4
- ${powerMockitoVersion}
- test
-
-
- org.powermock
- powermock-api-mockito2
- ${powerMockitoVersion}
+ net.bytebuddy
+ byte-buddy
+ ${byteBuddyVersion}
test
@@ -181,21 +171,13 @@
pom
test
-
- org.hamcrest
- hamcrest-core
-
org.mockito
- mockito-core
-
-
- org.powermock
- powermock-module-junit4
+ mockito-inline
- org.powermock
- powermock-api-mockito2
+ net.bytebuddy
+ byte-buddy
@@ -347,10 +329,11 @@
1.8
UTF-8
UTF-8
- 1.18.20
- 2.0.9
- 2.32.0
- 2.3.4
- 2.4.0
+ 1.18.38
+ 3.0.0-SNAPSHOT
+ 1.17.7
+ 4.8.0
+ 2.7.4
+ 2.7.4