diff --git a/OCPP-J/build.gradle b/OCPP-J/build.gradle index c96ef980f..90a522759 100644 --- a/OCPP-J/build.gradle +++ b/OCPP-J/build.gradle @@ -6,8 +6,8 @@ dependencies { compile project(':common') compile 'com.google.code.gson:gson:2.8.0' compile 'org.java-websocket:Java-WebSocket:1.5.3' - testCompile 'junit:junit:4.12' - testCompile 'org.mockito:mockito-core:1.10.19' + testCompile 'junit:junit:4.13.2' + testCompile 'org.mockito:mockito-core:4.11.0' testCompile 'org.hamcrest:hamcrest-core:1.3' } diff --git a/OCPP-J/pom.xml b/OCPP-J/pom.xml index 3e0f10a6f..e320bce06 100644 --- a/OCPP-J/pom.xml +++ b/OCPP-J/pom.xml @@ -72,7 +72,7 @@ org.mockito mockito-core - 1.10.19 + 4.11.0 test diff --git a/OCPP-J/src/test/java/eu/chargetime/ocpp/wss/test/BaseWssSocketBuilderTest.java b/OCPP-J/src/test/java/eu/chargetime/ocpp/wss/test/BaseWssSocketBuilderTest.java index 6ca62c104..517af993b 100644 --- a/OCPP-J/src/test/java/eu/chargetime/ocpp/wss/test/BaseWssSocketBuilderTest.java +++ b/OCPP-J/src/test/java/eu/chargetime/ocpp/wss/test/BaseWssSocketBuilderTest.java @@ -2,7 +2,7 @@ import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.*; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.*; import eu.chargetime.ocpp.wss.BaseWssFactoryBuilder; diff --git a/ocpp-common/build.gradle b/ocpp-common/build.gradle index 18b6757ca..88c6566f7 100644 --- a/ocpp-common/build.gradle +++ b/ocpp-common/build.gradle @@ -5,8 +5,8 @@ dependencies { compile group: 'javax.xml.soap', name: 'javax.xml.soap-api', version: '1.4.0' compile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.1' - testCompile 'junit:junit:4.12' - testCompile 'org.mockito:mockito-core:1.10.19' + testCompile 'junit:junit:4.13.2' + testCompile 'org.mockito:mockito-core:4.11.0' testCompile 'org.hamcrest:hamcrest-all:1.3' } diff --git a/ocpp-common/pom.xml b/ocpp-common/pom.xml index 3d3e6e2a5..b0d6b8831 100644 --- a/ocpp-common/pom.xml +++ b/ocpp-common/pom.xml @@ -80,7 +80,7 @@ org.mockito mockito-core - 1.10.19 + 4.11.0 test diff --git a/ocpp-common/src/test/java/eu/chargetime/ocpp/test/ClientTest.java b/ocpp-common/src/test/java/eu/chargetime/ocpp/test/ClientTest.java index c0ea87ee4..4c6aebd08 100644 --- a/ocpp-common/src/test/java/eu/chargetime/ocpp/test/ClientTest.java +++ b/ocpp-common/src/test/java/eu/chargetime/ocpp/test/ClientTest.java @@ -41,7 +41,7 @@ of this software and associated documentation files (the "Software"), to deal import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class ClientTest { @@ -59,7 +59,7 @@ public class ClientTest { @Before public void setup() { when(request.validate()).thenReturn(true); - doAnswer(invocation -> eventHandler = invocation.getArgumentAt(1, SessionEvents.class)) + doAnswer(invocation -> eventHandler = invocation.getArgument(1, SessionEvents.class)) .when(session) .open(any(), any()); @@ -77,7 +77,7 @@ public void connect_connects() { client.connect(someUrl, events); // Then - verify(session, times(1)).open(eq(someUrl), anyObject()); + verify(session, times(1)).open(eq(someUrl), any()); } @Test @@ -112,14 +112,15 @@ public void send_aMessage_isCommunicated() throws Exception { client.send(request); // Then - verify(session, times(1)).sendRequest(anyString(), eq(request), anyString()); + // TODO action and uuid should not be nullable + verify(session, times(1)).sendRequest(nullable(String.class), eq(request), nullable(String.class)); } @Test public void responseReceived_aMessageWasSend_PromiseIsCompleted() throws Exception { // Given String someUniqueId = "Some id"; - when(session.storeRequest(any())).thenReturn(someUniqueId); + lenient().when(session.storeRequest(any())).thenReturn(someUniqueId); when(promiseRepository.getPromise(any())).thenReturn(Optional.of(completableFuture)); // When diff --git a/ocpp-common/src/test/java/eu/chargetime/ocpp/test/CommunicatorTest.java b/ocpp-common/src/test/java/eu/chargetime/ocpp/test/CommunicatorTest.java index 9f6da1055..b506f608e 100644 --- a/ocpp-common/src/test/java/eu/chargetime/ocpp/test/CommunicatorTest.java +++ b/ocpp-common/src/test/java/eu/chargetime/ocpp/test/CommunicatorTest.java @@ -1,6 +1,6 @@ package eu.chargetime.ocpp.test; -import static org.mockito.Matchers.anyString; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.*; import eu.chargetime.ocpp.*; @@ -12,7 +12,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; /* ChargeTime.eu - Java-OCA-OCPP @@ -57,7 +57,7 @@ public void setup() throws Exception { when(transactionRelatedRequest.transactionRelated()).thenReturn(true); when(normalRequest.transactionRelated()).thenReturn(false); - doAnswer(invocation -> eventHandler = invocation.getArgumentAt(0, RadioEvents.class)) + doAnswer(invocation -> eventHandler = invocation.getArgument(0, RadioEvents.class)) .when(receiver) .accept(any()); setupCommunicator(true); diff --git a/ocpp-common/src/test/java/eu/chargetime/ocpp/test/ServerTest.java b/ocpp-common/src/test/java/eu/chargetime/ocpp/test/ServerTest.java index c6013ce71..1fedbe141 100644 --- a/ocpp-common/src/test/java/eu/chargetime/ocpp/test/ServerTest.java +++ b/ocpp-common/src/test/java/eu/chargetime/ocpp/test/ServerTest.java @@ -12,7 +12,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; /* ChargeTime.eu - Java-OCA-OCPP @@ -65,13 +65,13 @@ public void setup() { UUID sessionId = UUID.randomUUID(); when(request.validate()).thenReturn(true); when(session.getSessionId()).thenReturn(sessionId); - doAnswer(invocation -> listenerEvents = invocation.getArgumentAt(2, ListenerEvents.class)) + doAnswer(invocation -> listenerEvents = invocation.getArgument(2, ListenerEvents.class)) .when(listener) .open(anyString(), anyInt(), any()); - doAnswer(invocation -> sessionEvents = invocation.getArgumentAt(0, SessionEvents.class)) + doAnswer(invocation -> sessionEvents = invocation.getArgument(0, SessionEvents.class)) .when(session) .accept(any()); - doAnswer(invocation -> sessionIndex = invocation.getArgumentAt(0, UUID.class)) + doAnswer(invocation -> sessionIndex = invocation.getArgument(0, UUID.class)) .when(serverEvents) .newSession(any(), any()); @@ -114,7 +114,8 @@ public void send_aMessage_isCommunicated() throws Exception { server.send(sessionIndex, request); // Then - verify(session, times(1)).sendRequest(anyString(), eq(request), anyString()); + // TODO action and uuid should not be nullable + verify(session, times(1)).sendRequest(nullable(String.class), eq(request), nullable(String.class)); } @Test diff --git a/ocpp-common/src/test/java/eu/chargetime/ocpp/test/SessionTest.java b/ocpp-common/src/test/java/eu/chargetime/ocpp/test/SessionTest.java index ef55cdfd8..24e92ec7d 100644 --- a/ocpp-common/src/test/java/eu/chargetime/ocpp/test/SessionTest.java +++ b/ocpp-common/src/test/java/eu/chargetime/ocpp/test/SessionTest.java @@ -16,7 +16,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; /* ChargeTime.eu - Java-OCA-OCPP @@ -63,7 +63,7 @@ public class SessionTest { public void setup() throws Exception { when(featureRepository.findFeature(any())).thenReturn(Optional.of(feature)); session = new Session(communicator, queue, fulfiller, featureRepository); - doAnswer(invocation -> eventHandler = invocation.getArgumentAt(1, CommunicatorEvents.class)) + doAnswer(invocation -> eventHandler = invocation.getArgument(1, CommunicatorEvents.class)) .when(communicator) .connect(any(), any()); session.open(null, sessionEvents); @@ -103,7 +103,8 @@ public boolean validate() { session.sendRequest(someAction, someRequest, null); // Then - verify(communicator, times(1)).sendCall(anyString(), eq(someAction), eq(someRequest)); + // TODO uniqueid should not be nullable + verify(communicator, times(1)).sendCall(nullable(String.class), eq(someAction), eq(someRequest)); } @Test @@ -115,7 +116,8 @@ public void sendRequest_someUniqueId_sendsUniqueIdToCommunicator() { session.sendRequest(null, null, someUniqueId); // Then - verify(communicator, times(1)).sendCall(eq(someUniqueId), anyString(), any()); + // TODO uuid and request should not be nullable + verify(communicator, times(1)).sendCall(eq(someUniqueId), nullable(String.class), nullable(Request.class)); } @Test @@ -153,7 +155,7 @@ public void open_connectsViaCommunicator() { public void onCall_unhandledCallback_callSendCallError() throws Exception { // Given String someId = "Some id"; - doAnswer(invocation -> invocation.getArgumentAt(0, CompletableFuture.class).complete(null)) + doAnswer(invocation -> invocation.getArgument(0, CompletableFuture.class).complete(null)) .when(fulfiller) .fulfill(any(), any(), any()); when(communicator.unpackPayload(any(), any())).thenReturn(new TestRequest()); @@ -162,7 +164,8 @@ public void onCall_unhandledCallback_callSendCallError() throws Exception { eventHandler.onCall(someId, null, null); // then - verify(communicator, times(1)).sendCallError(eq(someId), anyString(), anyString(), anyString()); + // TODO action should not be nullable + verify(communicator, times(1)).sendCallError(eq(someId), nullable(String.class), anyString(), anyString()); } @Test @@ -178,7 +181,7 @@ public boolean validate() { doAnswer( invocation -> - invocation.getArgumentAt(0, CompletableFuture.class).complete(aConfirmation)) + invocation.getArgument(0, CompletableFuture.class).complete(aConfirmation)) .when(fulfiller) .fulfill(any(), any(), any()); when(communicator.unpackPayload(any(), any())).thenReturn(new TestRequest()); @@ -187,7 +190,8 @@ public boolean validate() { eventHandler.onCall(someId, null, null); // then - verify(communicator, times(1)).sendCallResult(anyString(), anyString(), eq(aConfirmation)); + // TODO action should not be nullable + verify(communicator, times(1)).sendCallResult(anyString(), nullable(String.class), eq(aConfirmation)); } @Test @@ -197,7 +201,7 @@ public void onCall_callbackThrowsException_callSendCallResult() throws Exception doAnswer( invocation -> invocation - .getArgumentAt(0, CompletableFuture.class) + .getArgument(0, CompletableFuture.class) .completeExceptionally(new Exception())) .when(fulfiller) .fulfill(any(), any(), any()); @@ -207,7 +211,8 @@ public void onCall_callbackThrowsException_callSendCallResult() throws Exception eventHandler.onCall(someId, null, null); // then - verify(communicator, times(1)).sendCallError(eq(someId), anyString(), anyString(), anyString()); + // TODO uniqueid should not be nullable + verify(communicator, times(1)).sendCallError(eq(someId), nullable(String.class), anyString(), anyString()); } @Test @@ -229,6 +234,7 @@ public void onCall_unknownAction_callSendCallError() { eventHandler.onCall(someId, null, null); // Then - verify(communicator, times(1)).sendCallError(eq(someId), anyString(), anyString(), anyString()); + // TODO uniqueid should not be nullable + verify(communicator, times(1)).sendCallError(eq(someId), nullable(String.class), anyString(), anyString()); } } diff --git a/ocpp-common/src/test/java/eu/chargetime/ocpp/test/SimpleRequestDispatcherTest.java b/ocpp-common/src/test/java/eu/chargetime/ocpp/test/SimpleRequestDispatcherTest.java index 511cafad1..030808ab9 100644 --- a/ocpp-common/src/test/java/eu/chargetime/ocpp/test/SimpleRequestDispatcherTest.java +++ b/ocpp-common/src/test/java/eu/chargetime/ocpp/test/SimpleRequestDispatcherTest.java @@ -27,7 +27,7 @@ of this software and associated documentation files (the "Software"), to deal import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; import eu.chargetime.ocpp.SessionEvents; @@ -38,7 +38,7 @@ of this software and associated documentation files (the "Software"), to deal import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class SimpleRequestDispatcherTest { diff --git a/ocpp-v1_6/build.gradle b/ocpp-v1_6/build.gradle index a324cfb3d..6d7b823e4 100644 --- a/ocpp-v1_6/build.gradle +++ b/ocpp-v1_6/build.gradle @@ -7,9 +7,9 @@ dependencies { compile project(':OCPP-J') compile 'org.java-websocket:Java-WebSocket:1.5.3' compile group: 'javax.xml.soap', name: 'javax.xml.soap-api', version: '1.4.0' - - testCompile 'junit:junit:4.12' - testCompile 'org.mockito:mockito-core:1.10.19' + + testCompile 'junit:junit:4.13.2' + testCompile 'org.mockito:mockito-core:4.11.0' testCompile 'org.hamcrest:hamcrest-core:1.3' } diff --git a/ocpp-v1_6/pom.xml b/ocpp-v1_6/pom.xml index 97dc7c344..ca3cac30b 100644 --- a/ocpp-v1_6/pom.xml +++ b/ocpp-v1_6/pom.xml @@ -71,7 +71,7 @@ org.mockito mockito-core - 1.10.19 + 4.11.0 test diff --git a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ClientCoreProfileTest.java b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ClientCoreProfileTest.java index 997d96537..d0c73ae61 100644 --- a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ClientCoreProfileTest.java +++ b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ClientCoreProfileTest.java @@ -17,7 +17,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; /* ChargeTime.eu - Java-OCA-OCPP diff --git a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ClientFirmwareManagementProfileTest.java b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ClientFirmwareManagementProfileTest.java index 07442192b..dc18611e1 100644 --- a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ClientFirmwareManagementProfileTest.java +++ b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ClientFirmwareManagementProfileTest.java @@ -29,7 +29,7 @@ of this software and associated documentation files (the "Software"), to deal import static org.hamcrest.CoreMatchers.instanceOf; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertThat; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -43,7 +43,7 @@ of this software and associated documentation files (the "Software"), to deal import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class ClientFirmwareManagementProfileTest extends ProfileTest { diff --git a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ClientLocalAuthListProfileTest.java b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ClientLocalAuthListProfileTest.java index e4286b89e..2c6837a40 100644 --- a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ClientLocalAuthListProfileTest.java +++ b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ClientLocalAuthListProfileTest.java @@ -28,7 +28,7 @@ import static org.hamcrest.CoreMatchers.instanceOf; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -45,7 +45,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class ClientLocalAuthListProfileTest extends ProfileTest { diff --git a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ClientRemoteTriggerProfileTest.java b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ClientRemoteTriggerProfileTest.java index f8b4d1800..b5055d5fd 100644 --- a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ClientRemoteTriggerProfileTest.java +++ b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ClientRemoteTriggerProfileTest.java @@ -16,7 +16,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; /* * ChargeTime.eu - Java-OCA-OCPP diff --git a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ClientReservationProfileTest.java b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ClientReservationProfileTest.java index 4edc50d6e..dcc33dd97 100644 --- a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ClientReservationProfileTest.java +++ b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ClientReservationProfileTest.java @@ -30,7 +30,7 @@ of this software and associated documentation files (the "Software"), to deal import static org.hamcrest.CoreMatchers.instanceOf; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertThat; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -47,7 +47,7 @@ of this software and associated documentation files (the "Software"), to deal import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class ClientReservationProfileTest extends ProfileTest { diff --git a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ClientSmartChargingProfileTest.java b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ClientSmartChargingProfileTest.java index 47e74d51d..31378f1f8 100644 --- a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ClientSmartChargingProfileTest.java +++ b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ClientSmartChargingProfileTest.java @@ -14,7 +14,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; /* * ChargeTime.eu - Java-OCA-OCPP diff --git a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ServerCoreProfileTest.java b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ServerCoreProfileTest.java index 9e8c6370c..576847456 100644 --- a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ServerCoreProfileTest.java +++ b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ServerCoreProfileTest.java @@ -3,7 +3,7 @@ import static org.hamcrest.CoreMatchers.instanceOf; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -17,7 +17,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; /* ChargeTime.eu - Java-OCA-OCPP diff --git a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ServerFirmwareManagementProfileTest.java b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ServerFirmwareManagementProfileTest.java index b937ad829..7ce1e3b73 100644 --- a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ServerFirmwareManagementProfileTest.java +++ b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ServerFirmwareManagementProfileTest.java @@ -28,7 +28,7 @@ of this software and associated documentation files (the "Software"), to deal import static org.hamcrest.CoreMatchers.instanceOf; import static org.junit.Assert.assertThat; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -45,7 +45,7 @@ of this software and associated documentation files (the "Software"), to deal import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class ServerFirmwareManagementProfileTest extends ProfileTest { diff --git a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ServerLocalAuthListProfileTest.java b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ServerLocalAuthListProfileTest.java index 71576d009..be68e20a1 100644 --- a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ServerLocalAuthListProfileTest.java +++ b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ServerLocalAuthListProfileTest.java @@ -37,7 +37,7 @@ of this software and associated documentation files (the "Software"), to deal import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class ServerLocalAuthListProfileTest extends ProfileTest { diff --git a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ServerRemoteTriggerProfileTest.java b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ServerRemoteTriggerProfileTest.java index 777eb98b3..f9fcc9f86 100644 --- a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ServerRemoteTriggerProfileTest.java +++ b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ServerRemoteTriggerProfileTest.java @@ -12,7 +12,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; /* * ChargeTime.eu - Java-OCA-OCPP diff --git a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ServerReservationProfileTest.java b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ServerReservationProfileTest.java index eec5a27bb..47bbcae17 100644 --- a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ServerReservationProfileTest.java +++ b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ServerReservationProfileTest.java @@ -36,7 +36,7 @@ of this software and associated documentation files (the "Software"), to deal import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class ServerReservationProfileTest extends ProfileTest { diff --git a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ServerSmartChargingProfileTest.java b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ServerSmartChargingProfileTest.java index 8ab9297b8..582972935 100644 --- a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ServerSmartChargingProfileTest.java +++ b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/ServerSmartChargingProfileTest.java @@ -14,7 +14,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; /* * ChargeTime.eu - Java-OCA-OCPP diff --git a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/securityext/ClientSecurityExtProfileTest.java b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/securityext/ClientSecurityExtProfileTest.java index 95c98fe0d..3378c66f8 100644 --- a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/securityext/ClientSecurityExtProfileTest.java +++ b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/securityext/ClientSecurityExtProfileTest.java @@ -40,8 +40,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; - +import org.mockito.junit.MockitoJUnitRunner; import java.time.ZonedDateTime; import java.util.UUID; diff --git a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/securityext/ServerSecurityExtProfileTest.java b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/securityext/ServerSecurityExtProfileTest.java index 85e74f702..7aa325283 100644 --- a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/securityext/ServerSecurityExtProfileTest.java +++ b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/feature/profile/test/securityext/ServerSecurityExtProfileTest.java @@ -41,8 +41,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; - +import org.mockito.junit.MockitoJUnitRunner; import java.util.UUID; import static org.junit.Assert.assertEquals; diff --git a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/localauthlist/test/GetLocalListVersionConfirmationTest.java b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/localauthlist/test/GetLocalListVersionConfirmationTest.java index db8bace37..326a1d132 100644 --- a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/localauthlist/test/GetLocalListVersionConfirmationTest.java +++ b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/localauthlist/test/GetLocalListVersionConfirmationTest.java @@ -11,7 +11,7 @@ import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class GetLocalListVersionConfirmationTest { diff --git a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/localauthlist/test/GetLocalListVersionRequestTest.java b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/localauthlist/test/GetLocalListVersionRequestTest.java index c1a6eb086..1e0541d67 100644 --- a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/localauthlist/test/GetLocalListVersionRequestTest.java +++ b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/localauthlist/test/GetLocalListVersionRequestTest.java @@ -8,7 +8,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class GetLocalListVersionRequestTest { diff --git a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/localauthlist/test/SendLocalListConfirmationTest.java b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/localauthlist/test/SendLocalListConfirmationTest.java index aba577136..c106aa1dc 100644 --- a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/localauthlist/test/SendLocalListConfirmationTest.java +++ b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/localauthlist/test/SendLocalListConfirmationTest.java @@ -12,7 +12,7 @@ import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class SendLocalListConfirmationTest { diff --git a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/localauthlist/test/SendLocalListRequestTest.java b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/localauthlist/test/SendLocalListRequestTest.java index b46545cd2..371a961ab 100644 --- a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/localauthlist/test/SendLocalListRequestTest.java +++ b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/localauthlist/test/SendLocalListRequestTest.java @@ -20,7 +20,7 @@ import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class SendLocalListRequestTest { diff --git a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/test/AuthorizeConfirmationTest.java b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/test/AuthorizeConfirmationTest.java index 5d798c3d2..9f3e63967 100644 --- a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/test/AuthorizeConfirmationTest.java +++ b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/test/AuthorizeConfirmationTest.java @@ -11,7 +11,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; /* ChargeTime.eu - Java-OCA-OCPP diff --git a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/test/GetCompositeScheduleRequestTest.java b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/test/GetCompositeScheduleRequestTest.java index 1baeaad2b..3d6d4b717 100644 --- a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/test/GetCompositeScheduleRequestTest.java +++ b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/test/GetCompositeScheduleRequestTest.java @@ -11,7 +11,7 @@ import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; /* * ChargeTime.eu - Java-OCA-OCPP diff --git a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/test/MeterValueTest.java b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/test/MeterValueTest.java index f5643ad0b..d45c19fa1 100644 --- a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/test/MeterValueTest.java +++ b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/test/MeterValueTest.java @@ -13,7 +13,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; /* * ChargeTime.eu - Java-OCA-OCPP @@ -107,7 +107,7 @@ public void validate_missingTimestamp_returnFalse() { // Given meterValue.setSampledValue(aList(sampledValueMock)); - when(sampledValueMock.validate()).thenReturn(true); + lenient().when(sampledValueMock.validate()).thenReturn(true); // When boolean isValid = meterValue.validate(); diff --git a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/test/MeterValuesRequestTest.java b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/test/MeterValuesRequestTest.java index bcb50c849..35578a927 100644 --- a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/test/MeterValuesRequestTest.java +++ b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/test/MeterValuesRequestTest.java @@ -14,7 +14,7 @@ import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; /* * ChargeTime.eu - Java-OCA-OCPP diff --git a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/test/JSONCommunicatorTest.java b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/test/JSONCommunicatorTest.java index 20aba0130..0436cf22a 100644 --- a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/test/JSONCommunicatorTest.java +++ b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/test/JSONCommunicatorTest.java @@ -19,7 +19,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; /* ChargeTime.eu - Java-OCA-OCPP diff --git a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/test/SOAPCommunicatorTest.java b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/test/SOAPCommunicatorTest.java index 848974b3c..05e2b3e5a 100644 --- a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/test/SOAPCommunicatorTest.java +++ b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/test/SOAPCommunicatorTest.java @@ -25,7 +25,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.w3c.dom.Document; import org.xml.sax.InputSource; diff --git a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/test/TimeoutSessionTest.java b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/test/TimeoutSessionTest.java index 9f33fe77d..e1d1f2d22 100644 --- a/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/test/TimeoutSessionTest.java +++ b/ocpp-v1_6/src/test/java/eu/chargetime/ocpp/test/TimeoutSessionTest.java @@ -1,6 +1,6 @@ package eu.chargetime.ocpp.test; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.*; import eu.chargetime.ocpp.ISession; @@ -11,7 +11,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; /* ChargeTime.eu - Java-OCA-OCPP @@ -50,10 +50,10 @@ public class TimeoutSessionTest { @Before public void setup() throws Exception { session = new TimeoutSessionDecorator(timeoutTimer, sessionMock); - doAnswer(invocation -> sessionEvents = invocation.getArgumentAt(0, SessionEvents.class)) + doAnswer(invocation -> sessionEvents = invocation.getArgument(0, SessionEvents.class)) .when(sessionMock) .accept(any()); - doAnswer(invocation -> sessionEvents = invocation.getArgumentAt(1, SessionEvents.class)) + doAnswer(invocation -> sessionEvents = invocation.getArgument(1, SessionEvents.class)) .when(sessionMock) .open(any(), any()); } diff --git a/ocpp-v2-test/build.gradle b/ocpp-v2-test/build.gradle index 8db4729d5..3ebd002dc 100644 --- a/ocpp-v2-test/build.gradle +++ b/ocpp-v2-test/build.gradle @@ -8,8 +8,8 @@ dependencies { compile project(':v1_6-test') compile project(':ocpp-v2') compile 'com.google.code.findbugs:jsr305:3.0.1' - testCompile 'junit:junit:4.12' - testCompile 'org.mockito:mockito-core:1.10.19' + testCompile 'junit:junit:4.13.2' + testCompile 'org.mockito:mockito-core:4.11.0' testCompile 'org.hamcrest:hamcrest-core:1.3' } diff --git a/ocpp-v2-test/pom.xml b/ocpp-v2-test/pom.xml index 235a1c404..056f3e1ba 100644 --- a/ocpp-v2-test/pom.xml +++ b/ocpp-v2-test/pom.xml @@ -85,7 +85,7 @@ org.mockito mockito-core - 1.10.19 + 4.11.0 test diff --git a/ocpp-v2-test/src/test/java/eu/chargetime/ocpp/test/OCPP201MultiProtocolIntegrationTest.java b/ocpp-v2-test/src/test/java/eu/chargetime/ocpp/test/OCPP201MultiProtocolIntegrationTest.java index 41cc59b73..e2a2f0635 100644 --- a/ocpp-v2-test/src/test/java/eu/chargetime/ocpp/test/OCPP201MultiProtocolIntegrationTest.java +++ b/ocpp-v2-test/src/test/java/eu/chargetime/ocpp/test/OCPP201MultiProtocolIntegrationTest.java @@ -42,7 +42,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; /** multiple protocol capable client and server integration test up to OCPP 2.0.1 */ @RunWith(MockitoJUnitRunner.class) diff --git a/ocpp-v2/build.gradle b/ocpp-v2/build.gradle index cf284dd60..666c85463 100644 --- a/ocpp-v2/build.gradle +++ b/ocpp-v2/build.gradle @@ -8,8 +8,8 @@ dependencies { compile project(':v1_6') compile 'com.google.code.findbugs:jsr305:3.0.1' compile 'org.java-websocket:Java-WebSocket:1.5.3' - testCompile 'junit:junit:4.12' - testCompile 'org.mockito:mockito-core:1.10.19' + testCompile 'junit:junit:4.13.2' + testCompile 'org.mockito:mockito-core:4.11.0' testCompile 'org.hamcrest:hamcrest-core:1.3' } diff --git a/ocpp-v2/pom.xml b/ocpp-v2/pom.xml index 3104cb90a..df5596931 100644 --- a/ocpp-v2/pom.xml +++ b/ocpp-v2/pom.xml @@ -81,7 +81,7 @@ org.mockito mockito-core - 1.10.19 + 4.11.0 test diff --git a/ocpp-v2_0/build.gradle b/ocpp-v2_0/build.gradle index 1026b166d..2d831fe5d 100644 --- a/ocpp-v2_0/build.gradle +++ b/ocpp-v2_0/build.gradle @@ -6,8 +6,8 @@ dependencies { compile project(':common') compile project(':OCPP-J') compile 'org.java-websocket:Java-WebSocket:1.5.3' - testCompile 'junit:junit:4.12' - testCompile 'org.mockito:mockito-core:1.10.19' + testCompile 'junit:junit:4.13.2' + testCompile 'org.mockito:mockito-core:4.11.0' testCompile 'org.hamcrest:hamcrest-core:1.3' } diff --git a/ocpp-v2_0/pom.xml b/ocpp-v2_0/pom.xml index e531addcf..94e70c886 100644 --- a/ocpp-v2_0/pom.xml +++ b/ocpp-v2_0/pom.xml @@ -71,7 +71,7 @@ org.mockito mockito-core - 1.10.19 + 4.11.0 test diff --git a/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/test/BootNotificationRequestTest.java b/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/test/BootNotificationRequestTest.java index 6999c66d7..bd001be6e 100644 --- a/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/test/BootNotificationRequestTest.java +++ b/ocpp-v2_0/src/test/java/eu/chargetime/ocpp/model/basic/test/BootNotificationRequestTest.java @@ -35,7 +35,7 @@ of this software and associated documentation files (the "Software"), to deal import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class BootNotificationRequestTest {