Skip to content

Commit

Permalink
No need to override reuseForks (#225)
Browse files Browse the repository at this point in the history
* No need to override `reuseForks`
* `org.mockito.Matchers` was deprecated and is now removed
  • Loading branch information
jglick authored Nov 10, 2021
1 parent d1469e3 commit 254990d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
10 changes: 1 addition & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ THE SOFTWARE.
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.29</version>
<version>4.31</version>
<relativePath />
</parent>

Expand Down Expand Up @@ -836,14 +836,6 @@ THE SOFTWARE.
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- not reuse because Mockito record stuff statically and some are changing between tests so it suc... -->
<reuseForks>false</reuseForks>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import org.junit.Test;
import org.jvnet.hudson.test.Issue;
import org.jvnet.hudson.test.RandomlyFails;
import org.mockito.Matchers;
import org.mockito.ArgumentMatchers;
import org.mockito.MockedStatic;
import org.mockito.Mockito;
import org.mockito.stubbing.Answer;
Expand All @@ -65,7 +65,7 @@ public void before() throws ComponentConfigurationException, URISyntaxException
this.archiver = new SurefireArchiver();
this.build = mock(MavenBuild.class);
final List<Action> actions = new ArrayList<>();
when(build.getAction(Matchers.any(Class.class))).thenAnswer( (Answer<Action>) invocation -> {
when(build.getAction(ArgumentMatchers.any(Class.class))).thenAnswer( (Answer<Action>) invocation -> {
Class<?> type = (Class<?>) invocation.getArguments()[0];
for (Action action : actions) {
if (type.isInstance(action)) {
Expand Down Expand Up @@ -103,7 +103,7 @@ private MojoInfo createMojoInfo() throws ComponentConfigurationException {

MojoInfo spy = spy(info);

doReturn(Boolean.FALSE).when(spy).getConfigurationValue(Matchers.anyString(), Matchers.eq(Boolean.class));
doReturn(Boolean.FALSE).when(spy).getConfigurationValue(ArgumentMatchers.anyString(), ArgumentMatchers.eq(Boolean.class));
return spy;
}

Expand Down

0 comments on commit 254990d

Please sign in to comment.