Using Mockito 2.13.0 framework
Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/28467105 Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/28467105 Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/28467105 Branch: refs/heads/master Commit: 2846710598dd98edef7de49c7327f63e30e309a4 Parents: 65d7f65 Author: Goldstein Lyor <[email protected]> Authored: Wed Dec 20 12:41:47 2017 +0200 Committer: Goldstein Lyor <[email protected]> Committed: Wed Dec 20 15:19:50 2017 +0200 ---------------------------------------------------------------------- pom.xml | 4 ++-- sshd-contrib/pom.xml | 2 +- .../password/InteractivePasswordIdentityProviderTest.java | 10 +++++----- sshd-core/pom.xml | 4 ++-- .../client/subsystem/sftp/DefaultCloseableHandleTest.java | 6 +++--- .../java/org/apache/sshd/common/AttributeStoreTest.java | 4 ++-- .../sshd/common/channel/ChannelPipedOutputStreamTest.java | 6 +++--- sshd-ldap/pom.xml | 10 +++++----- sshd-spring-sftp/pom.xml | 2 +- 9 files changed, 24 insertions(+), 24 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/28467105/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index aa9ed29..2a942c4 100644 --- a/pom.xml +++ b/pom.xml @@ -335,8 +335,8 @@ </dependency> <dependency> <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <version>1.10.19</version> + <artifactId>mockito-core</artifactId> + <version>2.13.0</version> </dependency> <dependency> <groupId>net.sf.jpam</groupId> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/28467105/sshd-contrib/pom.xml ---------------------------------------------------------------------- diff --git a/sshd-contrib/pom.xml b/sshd-contrib/pom.xml index 04be272..718dd7e 100644 --- a/sshd-contrib/pom.xml +++ b/sshd-contrib/pom.xml @@ -76,7 +76,7 @@ </dependency> <dependency> <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> + <artifactId>mockito-core</artifactId> <scope>test</scope> </dependency> </dependencies> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/28467105/sshd-contrib/src/test/java/org/apache/sshd/client/auth/password/InteractivePasswordIdentityProviderTest.java ---------------------------------------------------------------------- diff --git a/sshd-contrib/src/test/java/org/apache/sshd/client/auth/password/InteractivePasswordIdentityProviderTest.java b/sshd-contrib/src/test/java/org/apache/sshd/client/auth/password/InteractivePasswordIdentityProviderTest.java index af52e7a..a141960 100644 --- a/sshd-contrib/src/test/java/org/apache/sshd/client/auth/password/InteractivePasswordIdentityProviderTest.java +++ b/sshd-contrib/src/test/java/org/apache/sshd/client/auth/password/InteractivePasswordIdentityProviderTest.java @@ -28,7 +28,7 @@ import org.apache.sshd.util.test.BaseTestSupport; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runners.MethodSorters; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mockito; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; @@ -51,8 +51,8 @@ public class InteractivePasswordIdentityProviderTest extends BaseTestSupport { AtomicInteger passwordIndex = new AtomicInteger(0); String prompt = getCurrentTestName(); UserInteraction userInteraction = Mockito.mock(UserInteraction.class); - Mockito.when(userInteraction.isInteractionAllowed(Matchers.any(ClientSession.class))).thenReturn(Boolean.TRUE); - Mockito.when(userInteraction.getUpdatedPassword(Matchers.any(ClientSession.class), Matchers.anyString(), Matchers.anyString())) + Mockito.when(userInteraction.isInteractionAllowed(ArgumentMatchers.any(ClientSession.class))).thenReturn(Boolean.TRUE); + Mockito.when(userInteraction.getUpdatedPassword(ArgumentMatchers.any(ClientSession.class), ArgumentMatchers.anyString(), ArgumentMatchers.anyString())) .thenAnswer(new Answer<String>() { @Override public String answer(InvocationOnMock invocation) throws Throwable { @@ -87,8 +87,8 @@ public class InteractivePasswordIdentityProviderTest extends BaseTestSupport { public void testInteractionAllowedConsultation() { ClientSession session = Mockito.mock(ClientSession.class); UserInteraction userInteraction = Mockito.mock(UserInteraction.class); - Mockito.when(userInteraction.isInteractionAllowed(Matchers.any(ClientSession.class))).thenReturn(Boolean.FALSE); - Mockito.when(userInteraction.getUpdatedPassword(Matchers.any(ClientSession.class), Matchers.anyString(), Matchers.anyString())) + Mockito.when(userInteraction.isInteractionAllowed(ArgumentMatchers.any(ClientSession.class))).thenReturn(Boolean.FALSE); + Mockito.when(userInteraction.getUpdatedPassword(ArgumentMatchers.any(ClientSession.class), ArgumentMatchers.anyString(), ArgumentMatchers.anyString())) .thenThrow(new UnsupportedOperationException("Unexpected call")); PasswordIdentityProvider provider = InteractivePasswordIdentityProvider.providerOf(session, userInteraction, getCurrentTestName()); Iterable<String> passwords = provider.loadPasswords(); http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/28467105/sshd-core/pom.xml ---------------------------------------------------------------------- diff --git a/sshd-core/pom.xml b/sshd-core/pom.xml index a27b588..89a6f2a 100644 --- a/sshd-core/pom.xml +++ b/sshd-core/pom.xml @@ -52,7 +52,7 @@ <artifactId>tomcat-apr</artifactId> <optional>true</optional> </dependency> - + <dependency> <groupId>org.bouncycastle</groupId> <artifactId>bcpg-jdk15on</artifactId> @@ -104,7 +104,7 @@ </dependency> <dependency> <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> + <artifactId>mockito-core</artifactId> <scope>test</scope> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/28467105/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/DefaultCloseableHandleTest.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/DefaultCloseableHandleTest.java b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/DefaultCloseableHandleTest.java index 7d14e6c..eee30c5 100644 --- a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/DefaultCloseableHandleTest.java +++ b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/DefaultCloseableHandleTest.java @@ -29,7 +29,7 @@ import org.apache.sshd.util.test.BaseTestSupport; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runners.MethodSorters; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mockito; /** @@ -50,7 +50,7 @@ public class DefaultCloseableHandleTest extends BaseTestSupport { Handle handle = (Handle) args[0]; assertArrayEquals("Mismatched closing handle", id, handle.getIdentifier()); return null; - }).when(client).close(Matchers.any(Handle.class)); + }).when(client).close(ArgumentMatchers.any(Handle.class)); CloseableHandle handle = new DefaultCloseableHandle(client, getCurrentTestName(), id); try { @@ -71,7 +71,7 @@ public class DefaultCloseableHandleTest extends BaseTestSupport { Object[] args = invocation.getArguments(); assertFalse("Close already called on handle=" + args[0], closeCalled.getAndSet(true)); return null; - }).when(client).close(Matchers.any(Handle.class)); + }).when(client).close(ArgumentMatchers.any(Handle.class)); CloseableHandle handle = new DefaultCloseableHandle(client, getCurrentTestName(), getCurrentTestName().getBytes(StandardCharsets.UTF_8)); for (int index = 0; index < Byte.SIZE; index++) { http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/28467105/sshd-core/src/test/java/org/apache/sshd/common/AttributeStoreTest.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/test/java/org/apache/sshd/common/AttributeStoreTest.java b/sshd-core/src/test/java/org/apache/sshd/common/AttributeStoreTest.java index 6f73123..c0f1a73 100644 --- a/sshd-core/src/test/java/org/apache/sshd/common/AttributeStoreTest.java +++ b/sshd-core/src/test/java/org/apache/sshd/common/AttributeStoreTest.java @@ -28,7 +28,7 @@ import org.apache.sshd.util.test.BaseTestSupport; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runners.MethodSorters; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mockito; /** @@ -101,7 +101,7 @@ public class AttributeStoreTest extends BaseTestSupport { } private static String setAttributeValue(AttributeStore store, String value) { - Mockito.when(store.getAttribute(Matchers.eq(KEY))).thenReturn(value); + Mockito.when(store.getAttribute(ArgumentMatchers.eq(KEY))).thenReturn(value); return value; } } http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/28467105/sshd-core/src/test/java/org/apache/sshd/common/channel/ChannelPipedOutputStreamTest.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/test/java/org/apache/sshd/common/channel/ChannelPipedOutputStreamTest.java b/sshd-core/src/test/java/org/apache/sshd/common/channel/ChannelPipedOutputStreamTest.java index eb2d61f..5cbcefd 100644 --- a/sshd-core/src/test/java/org/apache/sshd/common/channel/ChannelPipedOutputStreamTest.java +++ b/sshd-core/src/test/java/org/apache/sshd/common/channel/ChannelPipedOutputStreamTest.java @@ -28,7 +28,7 @@ import org.apache.sshd.util.test.BaseTestSupport; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runners.MethodSorters; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mockito; /** @@ -51,10 +51,10 @@ public class ChannelPipedOutputStreamTest extends BaseTestSupport { AtomicInteger receiveCount = new AtomicInteger(0); Mockito.doAnswer(invocation -> { - Number len = invocation.getArgumentAt(2, Number.class); + Number len = invocation.getArgument(2); receiveCount.addAndGet(len.intValue()); return null; - }).when(sink).receive(Matchers.any(byte[].class), Matchers.anyInt(), Matchers.anyInt()); + }).when(sink).receive(ArgumentMatchers.any(byte[].class), ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt()); try (ChannelPipedOutputStream stream = new ChannelPipedOutputStream(sink)) { assertTrue("Stream not marked as initially open", stream.isOpen()); http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/28467105/sshd-ldap/pom.xml ---------------------------------------------------------------------- diff --git a/sshd-ldap/pom.xml b/sshd-ldap/pom.xml index 7fa0920..495b893 100644 --- a/sshd-ldap/pom.xml +++ b/sshd-ldap/pom.xml @@ -58,7 +58,7 @@ <artifactId>xpp3</artifactId> </exclusion> </exclusions> - </dependency> + </dependency> </dependencies> </dependencyManagement> @@ -75,19 +75,19 @@ <artifactId>apacheds-test-framework</artifactId> <version>${apacheds.version}</version> <scope>test</scope> - </dependency> + </dependency> <dependency> <groupId>org.apache.directory.server</groupId> <artifactId>apacheds-server-integ</artifactId> <version>${apacheds.version}</version> <scope>test</scope> - </dependency> + </dependency> <dependency> <groupId>org.apache.directory.server</groupId> <artifactId>apacheds-core-integ</artifactId> <version>${apacheds.version}</version> <scope>test</scope> - </dependency> + </dependency> <dependency> <groupId>org.apache.sshd</groupId> @@ -103,7 +103,7 @@ </dependency> <dependency> <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> + <artifactId>mockito-core</artifactId> <scope>test</scope> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/28467105/sshd-spring-sftp/pom.xml ---------------------------------------------------------------------- diff --git a/sshd-spring-sftp/pom.xml b/sshd-spring-sftp/pom.xml index aa76da7..455878e 100644 --- a/sshd-spring-sftp/pom.xml +++ b/sshd-spring-sftp/pom.xml @@ -107,7 +107,7 @@ </dependency> <dependency> <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> + <artifactId>mockito-core</artifactId> <scope>test</scope> </dependency> </dependencies>
