This is an automated email from the ASF dual-hosted git repository. slachiewicz pushed a commit to branch fix-deprecated in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
commit ee7fb9b645b8327616c0e3358527e94668055cc7 Author: Sylwester Lachiewicz <[email protected]> AuthorDate: Mon Jun 15 18:58:20 2026 +0200 Replace deprecated verifyZeroInteractions with verifyNoInteractions --- .../booterclient/ForkingRunListenerTest.java | 4 +- .../booterclient/output/ForkClientTest.java | 46 +++++++++++----------- .../surefire/extensions/StreamFeederTest.java | 6 +-- .../api/util/internal/ChannelsReaderTest.java | 4 +- .../api/util/internal/ChannelsWriterTest.java | 4 +- .../surefire/booter/ForkedBooterMockTest.java | 4 +- .../junitplatform/RunListenerAdapterTest.java | 4 +- 7 files changed, 36 insertions(+), 36 deletions(-) diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkingRunListenerTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkingRunListenerTest.java index d25e9b4ae..37f0a2353 100644 --- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkingRunListenerTest.java +++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkingRunListenerTest.java @@ -65,7 +65,7 @@ import static org.apache.maven.surefire.api.util.internal.Channels.newChannel; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; /** * @author Kristian Rosenvold @@ -277,7 +277,7 @@ private static List<Event> streamToEvent(byte[] stream) throws Exception { try (EventConsumerThread t = new EventConsumerThread("t", channel, handler, countdown, arguments)) { t.start(); countdown.awaitClosed(); - verifyZeroInteractions(logger); + verifyNoInteractions(logger); assertThat(arguments.isCalled()).isFalse(); for (int i = 0, size = handler.countEventsInCache(); i < size; i++) { events.add(handler.pullEvent()); diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClientTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClientTest.java index 4013cb074..eb13024bc 100644 --- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClientTest.java +++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClientTest.java @@ -91,8 +91,8 @@ import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; /** @@ -316,7 +316,7 @@ public void shouldAcquireNextTest() { client.handleEvent(new ControlNextTestEvent()); verify(notifiableTestStream, times(1)).provideNewTest(); verifyNoMoreInteractions(notifiableTestStream); - verifyZeroInteractions(factory); + verifyNoInteractions(factory); assertThat(client.isSaidGoodBye()).isFalse(); assertThat(client.getErrorInFork()).isNull(); assertThat(client.isErrorInFork()).isFalse(); @@ -341,7 +341,7 @@ public void shouldNotifyWithBye() { verify(notifiableTestStream, times(1)).acknowledgeByeEventReceived(); verify(notifiableTestStream, never()).shutdown(any(Shutdown.class)); verifyNoMoreInteractions(notifiableTestStream); - verifyZeroInteractions(factory); + verifyNoInteractions(factory); assertThat(client.isSaidGoodBye()).isTrue(); assertThat(client.getErrorInFork()).isNull(); assertThat(client.isErrorInFork()).isFalse(); @@ -362,8 +362,8 @@ public void shouldStopOnNextTest() { ForkClient client = new ForkClient(factory, notifiableTestStream, 0); client.setStopOnNextTestListener(() -> verified[0] = true); client.handleEvent(new ControlStopOnNextTestEvent()); - verifyZeroInteractions(notifiableTestStream); - verifyZeroInteractions(factory); + verifyNoInteractions(notifiableTestStream); + verifyNoInteractions(factory); assertThat(verified[0]).isTrue(); assertThat(client.isSaidGoodBye()).isFalse(); assertThat(client.getErrorInFork()).isNull(); @@ -385,7 +385,7 @@ public void shouldReceiveStdOut() { NotifiableTestStream notifiableTestStream = mock(NotifiableTestStream.class); ForkClient client = new ForkClient(factory, notifiableTestStream, 0); client.handleEvent(new StandardStreamOutEvent(NORMAL_RUN, 1L, "msg")); - verifyZeroInteractions(notifiableTestStream); + verifyNoInteractions(notifiableTestStream); verify(factory, times(1)).createTestReportListener(); verifyNoMoreInteractions(factory); assertThat(client.getReporter()).isNotNull(); @@ -411,7 +411,7 @@ public void shouldReceiveStdOutNewLine() { NotifiableTestStream notifiableTestStream = mock(NotifiableTestStream.class); ForkClient client = new ForkClient(factory, notifiableTestStream, 0); client.handleEvent(new StandardStreamOutWithNewLineEvent(NORMAL_RUN, 1L, "msg")); - verifyZeroInteractions(notifiableTestStream); + verifyNoInteractions(notifiableTestStream); verify(factory, times(1)).createTestReportListener(); verifyNoMoreInteractions(factory); assertThat(client.getReporter()).isNotNull(); @@ -437,7 +437,7 @@ public void shouldReceiveStdErr() { NotifiableTestStream notifiableTestStream = mock(NotifiableTestStream.class); ForkClient client = new ForkClient(factory, notifiableTestStream, 0); client.handleEvent(new StandardStreamErrEvent(NORMAL_RUN, 1L, "msg")); - verifyZeroInteractions(notifiableTestStream); + verifyNoInteractions(notifiableTestStream); verify(factory, times(1)).createTestReportListener(); verifyNoMoreInteractions(factory); assertThat(client.getReporter()).isNotNull(); @@ -463,7 +463,7 @@ public void shouldReceiveStdErrNewLine() { NotifiableTestStream notifiableTestStream = mock(NotifiableTestStream.class); ForkClient client = new ForkClient(factory, notifiableTestStream, 0); client.handleEvent(new StandardStreamErrWithNewLineEvent(NORMAL_RUN, 1L, "msg")); - verifyZeroInteractions(notifiableTestStream); + verifyNoInteractions(notifiableTestStream); verify(factory, times(1)).createTestReportListener(); verifyNoMoreInteractions(factory); assertThat(client.getReporter()).isNotNull(); @@ -489,7 +489,7 @@ public void shouldLogConsoleError() { new DeserializedStacktraceWriter("Listening for transport dt_socket at address: 5005", null, null); Event event = new ConsoleErrorEvent(stackTrace); client.handleEvent(event); - verifyZeroInteractions(notifiableTestStream); + verifyNoInteractions(notifiableTestStream); verify(factory, times(1)).createTestReportListener(); verify(factory, times(1)).getReportsDirectory(); verifyNoMoreInteractions(factory); @@ -552,7 +552,7 @@ public void shouldLogConsoleWarning() { NotifiableTestStream notifiableTestStream = mock(NotifiableTestStream.class); ForkClient client = new ForkClient(factory, notifiableTestStream, 0); client.handleEvent(new ConsoleWarningEvent("s1")); - verifyZeroInteractions(notifiableTestStream); + verifyNoInteractions(notifiableTestStream); verify(factory, times(1)).createTestReportListener(); verifyNoMoreInteractions(factory); assertThat(client.getReporter()).isNotNull(); @@ -578,7 +578,7 @@ public void shouldLogConsoleDebug() { NotifiableTestStream notifiableTestStream = mock(NotifiableTestStream.class); ForkClient client = new ForkClient(factory, notifiableTestStream, 0); client.handleEvent(new ConsoleDebugEvent("s1")); - verifyZeroInteractions(notifiableTestStream); + verifyNoInteractions(notifiableTestStream); verify(factory, times(1)).createTestReportListener(); verifyNoMoreInteractions(factory); assertThat(client.getReporter()).isNotNull(); @@ -604,7 +604,7 @@ public void shouldLogConsoleInfo() { NotifiableTestStream notifiableTestStream = mock(NotifiableTestStream.class); ForkClient client = new ForkClient(factory, notifiableTestStream, 0); client.handleEvent(new ConsoleInfoEvent("s1")); - verifyZeroInteractions(notifiableTestStream); + verifyNoInteractions(notifiableTestStream); verify(factory, times(1)).createTestReportListener(); verifyNoMoreInteractions(factory); assertThat(client.getReporter()).isNotNull(); @@ -630,8 +630,8 @@ public void shouldSendSystemProperty() { NotifiableTestStream notifiableTestStream = mock(NotifiableTestStream.class); ForkClient client = new ForkClient(factory, notifiableTestStream, 0); client.handleEvent(new SystemPropertyEvent(NORMAL_RUN, 1L, "k1", "v1")); - verifyZeroInteractions(notifiableTestStream); - verifyZeroInteractions(factory); + verifyNoInteractions(notifiableTestStream); + verifyNoInteractions(factory); assertThat(client.getReporter()).isNotNull(); assertThat(receiver.getEvents()).isEmpty(); assertThat(receiver.getData()).isEmpty(); @@ -766,7 +766,7 @@ public void shouldSendTestsetStarting() { client.handleEvent(new TestsetStartingEvent(reportEntry)); client.tryToTimeout(System.currentTimeMillis(), 1); - verifyZeroInteractions(notifiableTestStream); + verifyNoInteractions(notifiableTestStream); verify(factory).createTestReportListener(); verifyNoMoreInteractions(factory); assertThat(client.getReporter()).isNotNull(); @@ -846,7 +846,7 @@ public void shouldSendTestsetCompleted() { ForkClient client = new ForkClient(factory, notifiableTestStream, 0); client.handleEvent(new TestsetCompletedEvent(reportEntry)); - verifyZeroInteractions(notifiableTestStream); + verifyNoInteractions(notifiableTestStream); verify(factory).createTestReportListener(); verifyNoMoreInteractions(factory); assertThat(client.getReporter()).isNotNull(); @@ -926,7 +926,7 @@ public void shouldSendTestStarting() { ForkClient client = new ForkClient(factory, notifiableTestStream, 0); client.handleEvent(new TestStartingEvent(reportEntry)); - verifyZeroInteractions(notifiableTestStream); + verifyNoInteractions(notifiableTestStream); verify(factory).createTestReportListener(); verifyNoMoreInteractions(factory); assertThat(client.hasTestsInProgress()).isTrue(); @@ -1012,7 +1012,7 @@ public void shouldSendTestSucceeded() { client.handleEvent(new TestSucceededEvent(reportEntry)); - verifyZeroInteractions(notifiableTestStream); + verifyNoInteractions(notifiableTestStream); verify(factory).createTestReportListener(); verifyNoMoreInteractions(factory); assertThat(client.getReporter()).isNotNull(); @@ -1100,7 +1100,7 @@ public void shouldSendTestFailed() { client.handleEvent(new TestFailedEvent(reportEntry)); - verifyZeroInteractions(notifiableTestStream); + verifyNoInteractions(notifiableTestStream); verify(factory).createTestReportListener(); verifyNoMoreInteractions(factory); assertThat(client.getReporter()).isNotNull(); @@ -1192,7 +1192,7 @@ public void shouldSendTestSkipped() { client.handleEvent(new TestSkippedEvent(reportEntry)); - verifyZeroInteractions(notifiableTestStream); + verifyNoInteractions(notifiableTestStream); verify(factory).createTestReportListener(); verifyNoMoreInteractions(factory); assertThat(client.getReporter()).isNotNull(); @@ -1283,7 +1283,7 @@ public void shouldSendTestError() { client.handleEvent(new TestErrorEvent(reportEntry)); - verifyZeroInteractions(notifiableTestStream); + verifyNoInteractions(notifiableTestStream); verify(factory).createTestReportListener(); verifyNoMoreInteractions(factory); assertThat(client.getReporter()).isNotNull(); @@ -1372,7 +1372,7 @@ public void shouldSendTestAssumptionFailure() { client.handleEvent(new TestAssumptionFailureEvent(reportEntry)); - verifyZeroInteractions(notifiableTestStream); + verifyNoInteractions(notifiableTestStream); verify(factory).createTestReportListener(); verifyNoMoreInteractions(factory); assertThat(client.getReporter()).isNotNull(); diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/extensions/StreamFeederTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/extensions/StreamFeederTest.java index b3d835170..39554f177 100644 --- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/extensions/StreamFeederTest.java +++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/extensions/StreamFeederTest.java @@ -42,7 +42,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; /** @@ -117,7 +117,7 @@ public Object answer(InvocationOnMock invocation) throws IOException { assertThat(streamFeeder.getException()).isNull(); - verifyZeroInteractions(logger); + verifyNoInteractions(logger); } @Test @@ -141,6 +141,6 @@ public Object answer(InvocationOnMock invocation) throws IOException { assertThat(streamFeeder.getException()).isNotNull().isInstanceOf(IOException.class); - verifyZeroInteractions(logger); + verifyNoInteractions(logger); } } diff --git a/surefire-api/src/test/java/org/apache/maven/surefire/api/util/internal/ChannelsReaderTest.java b/surefire-api/src/test/java/org/apache/maven/surefire/api/util/internal/ChannelsReaderTest.java index 8ed934b12..08ac65265 100644 --- a/surefire-api/src/test/java/org/apache/maven/surefire/api/util/internal/ChannelsReaderTest.java +++ b/surefire-api/src/test/java/org/apache/maven/surefire/api/util/internal/ChannelsReaderTest.java @@ -53,8 +53,8 @@ import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; import static org.powermock.reflect.Whitebox.invokeMethod; @@ -345,7 +345,7 @@ public void shouldReadZeroLength() throws Exception { AsynchronousByteChannel channel = mock(AsynchronousByteChannel.class); InputStream is = Channels.newInputStream(channel); is.read(new byte[] {5}, 0, 0); - verifyZeroInteractions(channel); + verifyNoInteractions(channel); } @Test diff --git a/surefire-api/src/test/java/org/apache/maven/surefire/api/util/internal/ChannelsWriterTest.java b/surefire-api/src/test/java/org/apache/maven/surefire/api/util/internal/ChannelsWriterTest.java index 9a854256f..16ff0e7db 100644 --- a/surefire-api/src/test/java/org/apache/maven/surefire/api/util/internal/ChannelsWriterTest.java +++ b/surefire-api/src/test/java/org/apache/maven/surefire/api/util/internal/ChannelsWriterTest.java @@ -51,8 +51,8 @@ import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; /** @@ -278,7 +278,7 @@ public void shouldWriteZeroLength() throws Exception { AsynchronousByteChannel channel = mock(AsynchronousByteChannel.class); OutputStream os = Channels.newOutputStream(channel); os.write(new byte[] {5}, 0, 0); - verifyZeroInteractions(channel); + verifyNoInteractions(channel); } @Test diff --git a/surefire-booter/src/test/java/org/apache/maven/surefire/booter/ForkedBooterMockTest.java b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/ForkedBooterMockTest.java index 0c5dff743..e5676caf8 100644 --- a/surefire-booter/src/test/java/org/apache/maven/surefire/booter/ForkedBooterMockTest.java +++ b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/ForkedBooterMockTest.java @@ -71,7 +71,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.powermock.api.mockito.PowerMockito.doAnswer; import static org.powermock.api.mockito.PowerMockito.doCallRealMethod; import static org.powermock.api.mockito.PowerMockito.doNothing; @@ -194,7 +194,7 @@ public void shouldNotCloseChannelProcessorFactory() throws Exception { invokeMethod(booter, "closeForkChannel"); - verifyZeroInteractions(channelProcessorFactory); + verifyNoInteractions(channelProcessorFactory); } @Test diff --git a/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/RunListenerAdapterTest.java b/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/RunListenerAdapterTest.java index 69678aec4..cc93e6a0c 100644 --- a/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/RunListenerAdapterTest.java +++ b/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/RunListenerAdapterTest.java @@ -73,8 +73,8 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; import static org.powermock.reflect.Whitebox.getInternalState; @@ -229,7 +229,7 @@ public void displayNamesInClassAndMethods() throws Exception { assertThat(report.getValue().getSourceText()).isEqualTo("parent"); assertThat(report.getValue().getName()).isNull(); assertThat(report.getValue().getSystemProperties()).isEmpty(); - verifyZeroInteractions(listener); + verifyNoInteractions(listener); adapter.executionStarted(TestIdentifier.from(child1)); inOrder.verify(listener)
