Skip to content

Commit

Permalink
#1108 Update Mockito to 5.8.0
Browse files Browse the repository at this point in the history
* update version
* use mockito-core instead of mockito-all
* adjust tests for new version
  • Loading branch information
oliverlietz committed Dec 14, 2023
1 parent 1b8102c commit 4488f9a
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion containers/pax-exam-container-native/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;

import java.io.IOException;
import java.util.Map;

import org.junit.Test;
import org.mockito.Matchers;
import org.ops4j.pax.exam.ExamSystem;
import org.osgi.framework.launch.Framework;
import org.osgi.framework.launch.FrameworkFactory;
Expand All @@ -51,7 +50,7 @@ public void emptySetup() throws IOException {
public void starting() throws IOException {
FrameworkFactory ff = mock(FrameworkFactory.class);
Framework fw = mock(Framework.class);
when(ff.newFramework(Matchers.<Map<String, String>> anyObject())).thenReturn(fw);
when(ff.newFramework(any())).thenReturn(fw);
ExamSystem system = mock(ExamSystem.class);

NativeTestContainer container = new NativeTestContainer(system, ff);
Expand Down
2 changes: 1 addition & 1 deletion core/pax-exam-container-rbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.ops4j.pax.exam.rbc.internal;

import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.contains;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.contains;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
Expand Down
2 changes: 1 addition & 1 deletion core/pax-exam-invoker-junit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.isNotNull;
import static org.mockito.ArgumentMatchers.isNotNull;
import static org.mockito.Mockito.verify;

import org.junit.Test;
Expand All @@ -29,7 +29,7 @@
import org.junit.runner.Result;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;
import org.ops4j.pax.exam.util.Injector;
import org.osgi.framework.BundleContext;

Expand Down
2 changes: 1 addition & 1 deletion core/pax-exam-spi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.ops4j.pax.exam.CoreOptions.maven;
import static org.ops4j.pax.exam.CoreOptions.warProbe;
import static org.ops4j.pax.exam.spi.Probes.builder;
Expand Down Expand Up @@ -38,6 +38,8 @@ public class WarBuilderTest {
private File tempDir;
private ZipFile war;

private static final String MOCKITO_VERSION = "5.8.0"; // needs to match dependency in project

@BeforeClass
public static void setUp() throws IOException {
File pomProperties = new File("target/classes/META-INF/maven/org.ops4j.pax.exam/pax-exam-spi/pom.properties");
Expand Down Expand Up @@ -118,7 +120,7 @@ public void buildWarWithOverlayFromMaven() throws MalformedURLException, IOExcep
public void buildWarAutoClassPath() throws MalformedURLException, IOException {
war = localCopy(warProbe().classPathDefaultExcludes());
assertThat(war.getEntry("WEB-INF/beans.xml"), is(notNullValue()));
assertThat(war.getEntry("WEB-INF/lib/mockito-all-1.9.5.jar"), is(notNullValue()));
assertThat(war.getEntry(String.format("WEB-INF/lib/mockito-core-%s.jar", MOCKITO_VERSION)), is(notNullValue()));
String entry = String.format("WEB-INF/lib/tinybundles-%s.jar", Info.getPaxTinybundlesVersion());
assertThat(war.getEntry(entry), is(nullValue()));
}
Expand Down
2 changes: 1 addition & 1 deletion itest/osgi/src/it/regression-multi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>

Expand Down
2 changes: 1 addition & 1 deletion itest/osgi/src/it/regression-plumbing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>

Expand Down
2 changes: 1 addition & 1 deletion itest/osgi/src/it/regression-testng-perclass/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>

Expand Down
2 changes: 1 addition & 1 deletion itest/osgi/src/it/regression-testng/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>

Expand Down
5 changes: 2 additions & 3 deletions pom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
<dependency.junit.version>4.13.2</dependency.junit.version>
<dependency.openwebbeans.version>2.0.27</dependency.openwebbeans.version>
<dependency.osgicore.version>8.0.0</dependency.osgicore.version>
<dependency.mockito.version>1.9.5</dependency.mockito.version>
<dependency.asm.version>3.0</dependency.asm.version>
<dependency.atinject.version>1.2</dependency.atinject.version>
<dependency.deltaspike.version>1.9.6</dependency.deltaspike.version>
Expand Down Expand Up @@ -239,8 +238,8 @@
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>${dependency.mockito.version}</version>
<artifactId>mockito-core</artifactId>
<version>5.8.0</version>
<scope>test</scope>
</dependency>
<!-- URL Handlers are runtime artifacts. -->
Expand Down

0 comments on commit 4488f9a

Please sign in to comment.