You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2017/05/09 19:57:54 UTC

[02/50] [abbrv] httpcomponents-core git commit: Upgraded to Mockito 2.7

Upgraded to Mockito 2.7

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk@1791942 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/572bbd3a
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/572bbd3a
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/572bbd3a

Branch: refs/heads/trunk
Commit: 572bbd3a0275d0c30f0485e2ac39567778f8a395
Parents: 3778bbb
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Wed Apr 19 16:39:42 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Wed Apr 19 16:39:42 2017 +0000

----------------------------------------------------------------------
 .../testing/framework/ClientTestingAdapter.java |  2 +-
 .../testing/framework/TestTestingFramework.java |  8 ++--
 .../core5/http/impl/nio/TestChunkEncoder.java   |  4 +-
 .../http/impl/nio/TestIdentityEncoder.java      | 46 +++++++++---------
 .../impl/nio/TestLengthDelimitedEncoder.java    | 50 ++++++++++----------
 pom.xml                                         |  2 +-
 6 files changed, 56 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/572bbd3a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/ClientTestingAdapter.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/ClientTestingAdapter.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/ClientTestingAdapter.java
index 50ac49b..33ba080 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/ClientTestingAdapter.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/ClientTestingAdapter.java
@@ -110,7 +110,7 @@ public class ClientTestingAdapter {
      * See the documentation for the same method in {@link ClientPOJOAdapter}.
      */
     public boolean isRequestSupported(final Map<String, Object> request) {
-        return (adapter == null) ? true : adapter.checkRequestSupport(request) == null;
+        return (adapter == null) || adapter.checkRequestSupport(request) == null;
     };
 
     /**

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/572bbd3a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestTestingFramework.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestTestingFramework.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestTestingFramework.java
index 9e6b3dd..fd720ee 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestTestingFramework.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestTestingFramework.java
@@ -44,9 +44,9 @@ import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.hc.core5.http.ContentType;
 import org.apache.hc.core5.http.HttpVersion;
 import org.apache.hc.core5.http.ProtocolVersion;
-import org.apache.hc.core5.http.ContentType;
 import org.hamcrest.BaseMatcher;
 import org.hamcrest.Description;
 import org.hamcrest.Matcher;
@@ -129,7 +129,7 @@ public class TestTestingFramework {
         final ClientTestingAdapter adapter = Mockito.mock(ClientTestingAdapter.class);
 
         // Have isRequestSupported() return false so no test will run.
-        Mockito.when(adapter.isRequestSupported(Mockito.anyMap()))
+        Mockito.when(adapter.isRequestSupported(Mockito.<String, Object>anyMap()))
                      .thenReturn(false);
 
         final TestingFramework framework = newWebServerTestingFramework(adapter);
@@ -142,8 +142,8 @@ public class TestTestingFramework {
 
     @SuppressWarnings("unchecked")
     private void verifyCallMethodNeverCalled(final ClientTestingAdapter adapter) throws Exception {
-        Mockito.verify(adapter, Mockito.never()).execute(Mockito.anyString(), Mockito.anyMap(),
-                       Mockito.any(TestingFrameworkRequestHandler.class), Mockito.anyMap());
+        Mockito.verify(adapter, Mockito.never()).execute(Mockito.anyString(), Mockito.<String, Object>anyMap(),
+                       Mockito.any(TestingFrameworkRequestHandler.class), Mockito.<String, Object>anyMap());
     }
 
     private TestingFramework newFrameworkAndSetAdapter(final ClientTestingAdapter adapter)

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/572bbd3a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestChunkEncoder.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestChunkEncoder.java b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestChunkEncoder.java
index 4b604a9..921356d 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestChunkEncoder.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestChunkEncoder.java
@@ -38,7 +38,7 @@ import org.apache.hc.core5.http.message.BasicHeader;
 import org.apache.hc.core5.http.nio.SessionOutputBuffer;
 import org.junit.Assert;
 import org.junit.Test;
-import org.mockito.Matchers;
+import org.mockito.ArgumentMatchers;
 import org.mockito.Mockito;
 
 /**
@@ -128,7 +128,7 @@ public class TestChunkEncoder {
         Assert.assertEquals(16, encoder.write(CodecTestUtils.wrap("0123456789ABCDEF")));
         Assert.assertEquals(16, encoder.write(CodecTestUtils.wrap("0123456789ABCDEF")));
 
-        Mockito.verify(channel, Mockito.never()).write(Matchers.<ByteBuffer>any());
+        Mockito.verify(channel, Mockito.never()).write(ArgumentMatchers.<ByteBuffer>any());
 
         outbuf.flush(channel);
         final String s = channel.dump(StandardCharsets.US_ASCII);

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/572bbd3a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestIdentityEncoder.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestIdentityEncoder.java b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestIdentityEncoder.java
index 9e62c75..fcba011 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestIdentityEncoder.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestIdentityEncoder.java
@@ -41,7 +41,7 @@ import org.apache.hc.core5.util.CharArrayBuffer;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Test;
-import org.mockito.Matchers;
+import org.mockito.ArgumentMatchers;
 import org.mockito.Mockito;
 
 /**
@@ -318,8 +318,8 @@ public class TestIdentityEncoder {
         final IdentityEncoder encoder = new IdentityEncoder(channel, outbuf, metrics, 0);
         Assert.assertEquals(5, encoder.write(CodecTestUtils.wrap("stuff")));
 
-        Mockito.verify(channel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
-        Mockito.verify(outbuf, Mockito.never()).write(Matchers.<ByteBuffer>any());
+        Mockito.verify(channel, Mockito.times(2)).write(ArgumentMatchers.<ByteBuffer>any());
+        Mockito.verify(outbuf, Mockito.never()).write(ArgumentMatchers.<ByteBuffer>any());
         Mockito.verify(outbuf, Mockito.times(1)).flush(channel);
 
         Assert.assertEquals(13, metrics.getBytesTransferred());
@@ -342,8 +342,8 @@ public class TestIdentityEncoder {
         final IdentityEncoder encoder = new IdentityEncoder(channel, outbuf, metrics, 32);
         Assert.assertEquals(5, encoder.write(CodecTestUtils.wrap("stuff")));
 
-        Mockito.verify(channel, Mockito.never()).write(Matchers.<ByteBuffer>any());
-        Mockito.verify(outbuf, Mockito.times(1)).write(Matchers.<ByteBuffer>any());
+        Mockito.verify(channel, Mockito.never()).write(ArgumentMatchers.<ByteBuffer>any());
+        Mockito.verify(outbuf, Mockito.times(1)).write(ArgumentMatchers.<ByteBuffer>any());
         Mockito.verify(outbuf, Mockito.never()).flush(channel);
 
         Assert.assertEquals(0, metrics.getBytesTransferred());
@@ -365,8 +365,8 @@ public class TestIdentityEncoder {
         Assert.assertEquals(1, encoder.write(CodecTestUtils.wrap("-")));
         Assert.assertEquals(10, encoder.write(CodecTestUtils.wrap("more stuff")));
 
-        Mockito.verify(channel, Mockito.never()).write(Matchers.<ByteBuffer>any());
-        Mockito.verify(outbuf, Mockito.times(3)).write(Matchers.<ByteBuffer>any());
+        Mockito.verify(channel, Mockito.never()).write(ArgumentMatchers.<ByteBuffer>any());
+        Mockito.verify(outbuf, Mockito.times(3)).write(ArgumentMatchers.<ByteBuffer>any());
         Mockito.verify(outbuf, Mockito.never()).flush(channel);
 
         Assert.assertEquals(0, metrics.getBytesTransferred());
@@ -389,8 +389,8 @@ public class TestIdentityEncoder {
         final IdentityEncoder encoder = new IdentityEncoder(channel, outbuf, metrics, 2);
         Assert.assertEquals(5, encoder.write(CodecTestUtils.wrap("stuff")));
 
-        Mockito.verify(channel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
-        Mockito.verify(outbuf, Mockito.never()).write(Matchers.<ByteBuffer>any());
+        Mockito.verify(channel, Mockito.times(2)).write(ArgumentMatchers.<ByteBuffer>any());
+        Mockito.verify(outbuf, Mockito.never()).write(ArgumentMatchers.<ByteBuffer>any());
         Mockito.verify(outbuf, Mockito.times(1)).flush(channel);
 
         Assert.assertEquals(13, metrics.getBytesTransferred());
@@ -413,8 +413,8 @@ public class TestIdentityEncoder {
         Assert.assertEquals(1, encoder.write(CodecTestUtils.wrap("-")));
         Assert.assertEquals(10, encoder.write(CodecTestUtils.wrap("more stuff")));
 
-        Mockito.verify(channel, Mockito.times(5)).write(Matchers.<ByteBuffer>any());
-        Mockito.verify(outbuf, Mockito.times(3)).write(Matchers.<ByteBuffer>any());
+        Mockito.verify(channel, Mockito.times(5)).write(ArgumentMatchers.<ByteBuffer>any());
+        Mockito.verify(outbuf, Mockito.times(3)).write(ArgumentMatchers.<ByteBuffer>any());
         Mockito.verify(outbuf, Mockito.times(3)).flush(channel);
 
         Assert.assertEquals(18, metrics.getBytesTransferred());
@@ -438,8 +438,8 @@ public class TestIdentityEncoder {
         Assert.assertEquals(1, encoder.write(CodecTestUtils.wrap("-")));
         Assert.assertEquals(10, encoder.write(CodecTestUtils.wrap("more stuff")));
 
-        Mockito.verify(channel, Mockito.times(4)).write(Matchers.<ByteBuffer>any());
-        Mockito.verify(outbuf, Mockito.times(3)).write(Matchers.<ByteBuffer>any());
+        Mockito.verify(channel, Mockito.times(4)).write(ArgumentMatchers.<ByteBuffer>any());
+        Mockito.verify(outbuf, Mockito.times(3)).write(ArgumentMatchers.<ByteBuffer>any());
         Mockito.verify(outbuf, Mockito.times(2)).flush(channel);
 
         Assert.assertEquals(18, metrics.getBytesTransferred());
@@ -465,8 +465,8 @@ public class TestIdentityEncoder {
         Assert.assertEquals(2, encoder.write(CodecTestUtils.wrap("--")));
         Assert.assertEquals(10, encoder.write(CodecTestUtils.wrap("more stuff")));
 
-        Mockito.verify(channel, Mockito.times(4)).write(Matchers.<ByteBuffer>any());
-        Mockito.verify(outbuf, Mockito.times(5)).write(Matchers.<ByteBuffer>any());
+        Mockito.verify(channel, Mockito.times(4)).write(ArgumentMatchers.<ByteBuffer>any());
+        Mockito.verify(outbuf, Mockito.times(5)).write(ArgumentMatchers.<ByteBuffer>any());
         Mockito.verify(outbuf, Mockito.times(2)).flush(channel);
 
         Assert.assertEquals(21, metrics.getBytesTransferred());
@@ -487,8 +487,8 @@ public class TestIdentityEncoder {
         Assert.assertEquals(5, encoder.write(CodecTestUtils.wrap("stuff")));
         Assert.assertEquals(6, encoder.write(CodecTestUtils.wrap("-stuff")));
 
-        Mockito.verify(channel, Mockito.times(1)).write(Matchers.<ByteBuffer>any());
-        Mockito.verify(outbuf, Mockito.times(3)).write(Matchers.<ByteBuffer>any());
+        Mockito.verify(channel, Mockito.times(1)).write(ArgumentMatchers.<ByteBuffer>any());
+        Mockito.verify(outbuf, Mockito.times(3)).write(ArgumentMatchers.<ByteBuffer>any());
         Mockito.verify(outbuf, Mockito.times(1)).flush(channel);
 
         Assert.assertEquals(8, metrics.getBytesTransferred());
@@ -510,8 +510,8 @@ public class TestIdentityEncoder {
         Assert.assertEquals(5, encoder.write(CodecTestUtils.wrap("stuff")));
         Assert.assertEquals(16, encoder.write(CodecTestUtils.wrap("-much more stuff")));
 
-        Mockito.verify(channel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
-        Mockito.verify(outbuf, Mockito.times(1)).write(Matchers.<ByteBuffer>any());
+        Mockito.verify(channel, Mockito.times(2)).write(ArgumentMatchers.<ByteBuffer>any());
+        Mockito.verify(outbuf, Mockito.times(1)).write(ArgumentMatchers.<ByteBuffer>any());
         Mockito.verify(outbuf, Mockito.times(1)).flush(channel);
 
         Assert.assertEquals(21, metrics.getBytesTransferred());
@@ -540,8 +540,8 @@ public class TestIdentityEncoder {
         Assert.assertEquals(0, encoder.write(CodecTestUtils.wrap("-")));
         Assert.assertEquals(0, encoder.write(CodecTestUtils.wrap("more stuff")));
 
-        Mockito.verify(channel, Mockito.times(5)).write(Matchers.<ByteBuffer>any());
-        Mockito.verify(outbuf, Mockito.times(6)).write(Matchers.<ByteBuffer>any());
+        Mockito.verify(channel, Mockito.times(5)).write(ArgumentMatchers.<ByteBuffer>any());
+        Mockito.verify(outbuf, Mockito.times(6)).write(ArgumentMatchers.<ByteBuffer>any());
         Mockito.verify(outbuf, Mockito.times(4)).flush(channel);
 
         Assert.assertEquals(8, metrics.getBytesTransferred());
@@ -565,8 +565,8 @@ public class TestIdentityEncoder {
         Assert.assertEquals(1, encoder.write(CodecTestUtils.wrap("-")));
         Assert.assertEquals(1, encoder.write(CodecTestUtils.wrap("much more stuff")));
 
-        Mockito.verify(channel, Mockito.times(3)).write(Matchers.<ByteBuffer>any());
-        Mockito.verify(outbuf, Mockito.times(3)).write(Matchers.<ByteBuffer>any());
+        Mockito.verify(channel, Mockito.times(3)).write(ArgumentMatchers.<ByteBuffer>any());
+        Mockito.verify(outbuf, Mockito.times(3)).write(ArgumentMatchers.<ByteBuffer>any());
         Mockito.verify(outbuf, Mockito.times(1)).flush(channel);
 
         Assert.assertEquals(8, metrics.getBytesTransferred());

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/572bbd3a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestLengthDelimitedEncoder.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestLengthDelimitedEncoder.java b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestLengthDelimitedEncoder.java
index 36b57f0..248eaac 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestLengthDelimitedEncoder.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestLengthDelimitedEncoder.java
@@ -41,7 +41,7 @@ import org.apache.hc.core5.util.CharArrayBuffer;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Test;
-import org.mockito.Matchers;
+import org.mockito.ArgumentMatchers;
 import org.mockito.Mockito;
 
 /**
@@ -377,8 +377,8 @@ public class TestLengthDelimitedEncoder {
             100, 0);
         Assert.assertEquals(5, encoder.write(CodecTestUtils.wrap("stuff")));
 
-        Mockito.verify(channel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
-        Mockito.verify(outbuf, Mockito.never()).write(Matchers.<ByteBuffer>any());
+        Mockito.verify(channel, Mockito.times(2)).write(ArgumentMatchers.<ByteBuffer>any());
+        Mockito.verify(outbuf, Mockito.never()).write(ArgumentMatchers.<ByteBuffer>any());
         Mockito.verify(outbuf, Mockito.times(1)).flush(channel);
 
         Assert.assertEquals(13, metrics.getBytesTransferred());
@@ -402,8 +402,8 @@ public class TestLengthDelimitedEncoder {
             100, 32);
         Assert.assertEquals(5, encoder.write(CodecTestUtils.wrap("stuff")));
 
-        Mockito.verify(channel, Mockito.never()).write(Matchers.<ByteBuffer>any());
-        Mockito.verify(outbuf, Mockito.times(1)).write(Matchers.<ByteBuffer>any());
+        Mockito.verify(channel, Mockito.never()).write(ArgumentMatchers.<ByteBuffer>any());
+        Mockito.verify(outbuf, Mockito.times(1)).write(ArgumentMatchers.<ByteBuffer>any());
         Mockito.verify(outbuf, Mockito.never()).flush(channel);
 
         Assert.assertEquals(0, metrics.getBytesTransferred());
@@ -426,8 +426,8 @@ public class TestLengthDelimitedEncoder {
         Assert.assertEquals(1, encoder.write(CodecTestUtils.wrap("-")));
         Assert.assertEquals(10, encoder.write(CodecTestUtils.wrap("more stuff")));
 
-        Mockito.verify(channel, Mockito.never()).write(Matchers.<ByteBuffer>any());
-        Mockito.verify(outbuf, Mockito.times(3)).write(Matchers.<ByteBuffer>any());
+        Mockito.verify(channel, Mockito.never()).write(ArgumentMatchers.<ByteBuffer>any());
+        Mockito.verify(outbuf, Mockito.times(3)).write(ArgumentMatchers.<ByteBuffer>any());
         Mockito.verify(outbuf, Mockito.never()).flush(channel);
 
         Assert.assertEquals(0, metrics.getBytesTransferred());
@@ -450,8 +450,8 @@ public class TestLengthDelimitedEncoder {
         Assert.assertEquals(1, encoder.write(CodecTestUtils.wrap("-")));
         Assert.assertEquals(10, encoder.write(CodecTestUtils.wrap("more stuff; and a lot more stuff")));
 
-        Mockito.verify(channel, Mockito.never()).write(Matchers.<ByteBuffer>any());
-        Mockito.verify(outbuf, Mockito.times(3)).write(Matchers.<ByteBuffer>any());
+        Mockito.verify(channel, Mockito.never()).write(ArgumentMatchers.<ByteBuffer>any());
+        Mockito.verify(outbuf, Mockito.times(3)).write(ArgumentMatchers.<ByteBuffer>any());
         Mockito.verify(outbuf, Mockito.never()).flush(channel);
 
         Assert.assertEquals(0, metrics.getBytesTransferred());
@@ -475,8 +475,8 @@ public class TestLengthDelimitedEncoder {
             100, 2);
         Assert.assertEquals(5, encoder.write(CodecTestUtils.wrap("stuff")));
 
-        Mockito.verify(channel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
-        Mockito.verify(outbuf, Mockito.never()).write(Matchers.<ByteBuffer>any());
+        Mockito.verify(channel, Mockito.times(2)).write(ArgumentMatchers.<ByteBuffer>any());
+        Mockito.verify(outbuf, Mockito.never()).write(ArgumentMatchers.<ByteBuffer>any());
         Mockito.verify(outbuf, Mockito.times(1)).flush(channel);
 
         Assert.assertEquals(13, metrics.getBytesTransferred());
@@ -500,8 +500,8 @@ public class TestLengthDelimitedEncoder {
         Assert.assertEquals(1, encoder.write(CodecTestUtils.wrap("-")));
         Assert.assertEquals(10, encoder.write(CodecTestUtils.wrap("more stuff")));
 
-        Mockito.verify(channel, Mockito.times(5)).write(Matchers.<ByteBuffer>any());
-        Mockito.verify(outbuf, Mockito.times(3)).write(Matchers.<ByteBuffer>any());
+        Mockito.verify(channel, Mockito.times(5)).write(ArgumentMatchers.<ByteBuffer>any());
+        Mockito.verify(outbuf, Mockito.times(3)).write(ArgumentMatchers.<ByteBuffer>any());
         Mockito.verify(outbuf, Mockito.times(3)).flush(channel);
 
         Assert.assertEquals(18, metrics.getBytesTransferred());
@@ -526,8 +526,8 @@ public class TestLengthDelimitedEncoder {
         Assert.assertEquals(1, encoder.write(CodecTestUtils.wrap("-")));
         Assert.assertEquals(10, encoder.write(CodecTestUtils.wrap("more stuff")));
 
-        Mockito.verify(channel, Mockito.times(4)).write(Matchers.<ByteBuffer>any());
-        Mockito.verify(outbuf, Mockito.times(3)).write(Matchers.<ByteBuffer>any());
+        Mockito.verify(channel, Mockito.times(4)).write(ArgumentMatchers.<ByteBuffer>any());
+        Mockito.verify(outbuf, Mockito.times(3)).write(ArgumentMatchers.<ByteBuffer>any());
         Mockito.verify(outbuf, Mockito.times(2)).flush(channel);
 
         Assert.assertEquals(18, metrics.getBytesTransferred());
@@ -554,8 +554,8 @@ public class TestLengthDelimitedEncoder {
         Assert.assertEquals(2, encoder.write(CodecTestUtils.wrap("--")));
         Assert.assertEquals(10, encoder.write(CodecTestUtils.wrap("more stuff")));
 
-        Mockito.verify(channel, Mockito.times(4)).write(Matchers.<ByteBuffer>any());
-        Mockito.verify(outbuf, Mockito.times(5)).write(Matchers.<ByteBuffer>any());
+        Mockito.verify(channel, Mockito.times(4)).write(ArgumentMatchers.<ByteBuffer>any());
+        Mockito.verify(outbuf, Mockito.times(5)).write(ArgumentMatchers.<ByteBuffer>any());
         Mockito.verify(outbuf, Mockito.times(2)).flush(channel);
 
         Assert.assertEquals(21, metrics.getBytesTransferred());
@@ -577,8 +577,8 @@ public class TestLengthDelimitedEncoder {
         Assert.assertEquals(5, encoder.write(CodecTestUtils.wrap("stuff")));
         Assert.assertEquals(6, encoder.write(CodecTestUtils.wrap("-stuff")));
 
-        Mockito.verify(channel, Mockito.times(1)).write(Matchers.<ByteBuffer>any());
-        Mockito.verify(outbuf, Mockito.times(3)).write(Matchers.<ByteBuffer>any());
+        Mockito.verify(channel, Mockito.times(1)).write(ArgumentMatchers.<ByteBuffer>any());
+        Mockito.verify(outbuf, Mockito.times(3)).write(ArgumentMatchers.<ByteBuffer>any());
         Mockito.verify(outbuf, Mockito.times(1)).flush(channel);
 
         Assert.assertEquals(8, metrics.getBytesTransferred());
@@ -601,8 +601,8 @@ public class TestLengthDelimitedEncoder {
         Assert.assertEquals(5, encoder.write(CodecTestUtils.wrap("stuff")));
         Assert.assertEquals(16, encoder.write(CodecTestUtils.wrap("-much more stuff")));
 
-        Mockito.verify(channel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
-        Mockito.verify(outbuf, Mockito.times(1)).write(Matchers.<ByteBuffer>any());
+        Mockito.verify(channel, Mockito.times(2)).write(ArgumentMatchers.<ByteBuffer>any());
+        Mockito.verify(outbuf, Mockito.times(1)).write(ArgumentMatchers.<ByteBuffer>any());
         Mockito.verify(outbuf, Mockito.times(1)).flush(channel);
 
         Assert.assertEquals(21, metrics.getBytesTransferred());
@@ -632,8 +632,8 @@ public class TestLengthDelimitedEncoder {
         Assert.assertEquals(0, encoder.write(CodecTestUtils.wrap("-")));
         Assert.assertEquals(0, encoder.write(CodecTestUtils.wrap("more stuff")));
 
-        Mockito.verify(channel, Mockito.times(5)).write(Matchers.<ByteBuffer>any());
-        Mockito.verify(outbuf, Mockito.times(6)).write(Matchers.<ByteBuffer>any());
+        Mockito.verify(channel, Mockito.times(5)).write(ArgumentMatchers.<ByteBuffer>any());
+        Mockito.verify(outbuf, Mockito.times(6)).write(ArgumentMatchers.<ByteBuffer>any());
         Mockito.verify(outbuf, Mockito.times(4)).flush(channel);
 
         Assert.assertEquals(8, metrics.getBytesTransferred());
@@ -658,8 +658,8 @@ public class TestLengthDelimitedEncoder {
         Assert.assertEquals(1, encoder.write(CodecTestUtils.wrap("-")));
         Assert.assertEquals(1, encoder.write(CodecTestUtils.wrap("much more stuff")));
 
-        Mockito.verify(channel, Mockito.times(3)).write(Matchers.<ByteBuffer>any());
-        Mockito.verify(outbuf, Mockito.times(3)).write(Matchers.<ByteBuffer>any());
+        Mockito.verify(channel, Mockito.times(3)).write(ArgumentMatchers.<ByteBuffer>any());
+        Mockito.verify(outbuf, Mockito.times(3)).write(ArgumentMatchers.<ByteBuffer>any());
         Mockito.verify(outbuf, Mockito.times(1)).flush(channel);
 
         Assert.assertEquals(8, metrics.getBytesTransferred());

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/572bbd3a/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index de29905..3386352 100644
--- a/pom.xml
+++ b/pom.xml
@@ -78,7 +78,7 @@
     <maven.compiler.target>1.7</maven.compiler.target>
     <maven.compiler.showDeprecation>true</maven.compiler.showDeprecation>
     <junit.version>4.12</junit.version>
-    <mockito.version>1.10.19</mockito.version>
+    <mockito.version>2.7.22</mockito.version>
     <log4j.version>2.8</log4j.version>
     <hc.stylecheck.version>1</hc.stylecheck.version>
   </properties>