Skip to content

Commit 1c59dc9

Browse files
committed
chore(deps): bump Mockito to 5.21.0
Update tests and custom verification helper to align with Mockito 5 APIs and matchers. Signed-off-by: Oleksii Orel <oorel@redhat.com>
1 parent dba3d91 commit 1c59dc9

File tree

5 files changed

+13
-16
lines changed

5 files changed

+13
-16
lines changed

core/che-core-api-core/src/test/java/org/eclipse/che/api/core/util/lineconsumer/ConcurrentCompositeLineConsumerTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012-2025 Red Hat, Inc.
2+
* Copyright (c) 2012-2026 Red Hat, Inc.
33
* This program and the accompanying materials are made
44
* available under the terms of the Eclipse Public License 2.0
55
* which is available at https://www.eclipse.org/legal/epl-2.0/
@@ -32,10 +32,10 @@
3232
import org.eclipse.che.commons.test.mockito.answer.WaitingAnswer;
3333
import org.mockito.Mock;
3434
import org.mockito.exceptions.base.MockitoException;
35-
import org.mockito.internal.invocation.InvocationMatcher;
3635
import org.mockito.internal.verification.VerificationModeFactory;
3736
import org.mockito.internal.verification.api.VerificationData;
3837
import org.mockito.invocation.Invocation;
38+
import org.mockito.invocation.MatchableInvocation;
3939
import org.mockito.testng.MockitoTestNGListener;
4040
import org.mockito.verification.VerificationMode;
4141
import org.testng.annotations.AfterMethod;
@@ -270,7 +270,7 @@ public Last() {}
270270

271271
public void verify(VerificationData verificationData) {
272272
List<Invocation> invocations = verificationData.getAllInvocations();
273-
InvocationMatcher invocationMatcher = verificationData.getWanted();
273+
MatchableInvocation invocationMatcher = verificationData.getTarget();
274274

275275
if (invocations == null || invocations.isEmpty()) {
276276
throw new MockitoException(

infrastructures/kubernetes/src/test/java/org/eclipse/che/workspace/infrastructure/kubernetes/docker/auth/UserSpecificDockerRegistryCredentialsProviderTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012-2025 Red Hat, Inc.
2+
* Copyright (c) 2012-2026 Red Hat, Inc.
33
* This program and the accompanying materials are made
44
* available under the terms of the Eclipse Public License 2.0
55
* which is available at https://www.eclipse.org/legal/epl-2.0/
@@ -11,7 +11,7 @@
1111
*/
1212
package org.eclipse.che.workspace.infrastructure.kubernetes.docker.auth;
1313

14-
import static org.mockito.ArgumentMatchers.anyObject;
14+
import static org.mockito.ArgumentMatchers.anyString;
1515
import static org.mockito.Mockito.when;
1616
import static org.testng.Assert.assertEquals;
1717
import static org.testng.Assert.assertNotNull;
@@ -104,6 +104,6 @@ private void setCredentialsIntoPreferences(String base64encodedCredentials)
104104
preferences.put(DOCKER_REGISTRY_CREDENTIALS_KEY, base64encodedCredentials);
105105

106106
EnvironmentContext.getCurrent().setSubject(new SubjectImpl("name", "id", "token1234", false));
107-
when(preferenceManager.find(anyObject(), anyObject())).thenReturn(preferences);
107+
when(preferenceManager.find(anyString(), anyString())).thenReturn(preferences);
108108
}
109109
}

infrastructures/kubernetes/src/test/java/org/eclipse/che/workspace/infrastructure/kubernetes/namespace/configurator/CredentialsSecretConfiguratorTest.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012-2025 Red Hat, Inc.
2+
* Copyright (c) 2012-2026 Red Hat, Inc.
33
* This program and the accompanying materials are made
44
* available under the terms of the Eclipse Public License 2.0
55
* which is available at https://www.eclipse.org/legal/epl-2.0/
@@ -15,7 +15,6 @@
1515
import static org.mockito.ArgumentMatchers.eq;
1616
import static org.mockito.Mockito.doThrow;
1717
import static org.mockito.Mockito.never;
18-
import static org.mockito.Mockito.spy;
1918
import static org.mockito.Mockito.verify;
2019
import static org.mockito.Mockito.when;
2120
import static org.testng.Assert.assertEquals;
@@ -84,10 +83,8 @@ public void setUp() throws InfrastructureException {
8483
new KubernetesMixedDispatcher(responses),
8584
true);
8685
kubernetesMockServer.init();
87-
kubernetesClient = spy(kubernetesMockServer.createClient());
88-
89-
KubernetesClient client = spy(kubernetesClient);
90-
when(cheServerKubernetesClientFactory.create()).thenReturn(client);
86+
kubernetesClient = kubernetesMockServer.createClient();
87+
when(cheServerKubernetesClientFactory.create()).thenReturn(kubernetesClient);
9188

9289
namespaceResolutionContext =
9390
new NamespaceResolutionContext(TEST_WORKSPACE_ID, TEST_USER_ID, TEST_USERNAME);

multiuser/permission/che-multiuser-permission-system/src/test/java/org/eclipse/che/multiuser/permission/system/JvmServicePermissionsFilterTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012-2025 Red Hat, Inc.
2+
* Copyright (c) 2012-2026 Red Hat, Inc.
33
* This program and the accompanying materials are made
44
* available under the terms of the Eclipse Public License 2.0
55
* which is available at https://www.eclipse.org/legal/epl-2.0/
@@ -17,7 +17,7 @@
1717
import static org.everrest.assured.JettyHttpServer.ADMIN_USER_NAME;
1818
import static org.everrest.assured.JettyHttpServer.ADMIN_USER_PASSWORD;
1919
import static org.everrest.assured.JettyHttpServer.SECURE_PATH;
20-
import static org.mockito.ArgumentMatchers.anyObject;
20+
import static org.mockito.ArgumentMatchers.any;
2121
import static org.mockito.Mockito.doAnswer;
2222
import static org.mockito.Mockito.never;
2323
import static org.mockito.Mockito.verify;
@@ -146,7 +146,7 @@ private static void permitSubject(String... allowedActions) throws ForbiddenExce
146146
return null;
147147
})
148148
.when(subject)
149-
.checkPermission(anyObject(), anyObject(), anyObject());
149+
.checkPermission(any(), any(), any());
150150
}
151151

152152
private static Set<String> getDeclaredPublicMethods(Class<?> c) {

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@
151151
<org.jgroups.version>4.1.9.Final</org.jgroups.version>
152152
<org.leadpony.justify.version>3.1.0</org.leadpony.justify.version>
153153
<org.mockito.mockito-testng.version>0.5.4</org.mockito.mockito-testng.version>
154-
<org.mockito.version>3.11.2</org.mockito.version>
154+
<org.mockito.version>5.21.0</org.mockito.version>
155155
<org.postgresql.version>42.7.9</org.postgresql.version>
156156
<org.reflections.version>0.9.9</org.reflections.version>
157157
<org.slf4j.version>2.0.17</org.slf4j.version>

0 commit comments

Comments
 (0)