httpcomponents-core/0002-Port-to-Mockito-5.patch

2385 lines
133 KiB
Diff
Raw Normal View History

2023-12-12 11:25:29 +00:00
From d813592b77c355396b4114bd1a4ddbb77cbede9c Mon Sep 17 00:00:00 2001
From: Marian Koncek <mkoncek@redhat.com>
Date: Tue, 12 Dec 2023 12:22:49 +0100
Subject: [PATCH] Port to Mockito 5
Generated by running:
find -name '*.java' -exec sed -i \
-e 's/org\.mockito\.Matchers/org.mockito.ArgumentMatchers/g' \
-e 's/\([^[:alnum:]]\)Matchers\([^[:alnum:]]\)/\1ArgumentMatchers\2/g' \
-e 's/Mockito\.anyObject()/Mockito\.any()/g' \
{} +
---
.../nio/TestDefaultNHttpClientConnection.java | 124 ++++++------
.../nio/TestDefaultNHttpServerConnection.java | 124 ++++++------
.../impl/nio/codecs/TestChunkEncoder.java | 4 +-
.../impl/nio/codecs/TestIdentityEncoder.java | 46 ++---
.../codecs/TestLengthDelimitedEncoder.java | 50 ++---
.../impl/nio/pool/TestBasicNIOConnPool.java | 10 +-
.../apache/http/nio/pool/TestNIOConnPool.java | 188 +++++++++---------
.../TestBasicAsyncClientExchangeHandler.java | 4 +-
.../TestBasicAsyncRequestHandler.java | 4 +-
.../TestHttpAsyncRequestExecutor.java | 16 +-
.../nio/protocol/TestHttpAsyncRequester.java | 18 +-
.../nio/protocol/TestHttpAsyncService.java | 70 +++----
.../http/impl/TestBHttpConnectionBase.java | 24 +--
.../http/impl/io/TestSessionInOutBuffers.java | 10 +-
.../org/apache/http/pool/TestConnPool.java | 58 +++---
.../protocol/TestHttpRequestExecutor.java | 10 +-
.../apache/http/protocol/TestHttpService.java | 6 +-
17 files changed, 383 insertions(+), 383 deletions(-)
diff --git a/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpClientConnection.java b/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpClientConnection.java
index f404bfb..775878e 100644
--- a/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpClientConnection.java
+++ b/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpClientConnection.java
@@ -57,7 +57,7 @@ import org.apache.http.protocol.HTTP;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.mockito.Matchers;
+import org.mockito.ArgumentMatchers;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
@@ -180,7 +180,7 @@ public class TestDefaultNHttpClientConnection {
Assert.assertEquals(19, conn.outbuf.length());
Mockito.doAnswer(new ProduceContentAnswer(entity)).when(
- handler).outputReady(Matchers.<NHttpClientConnection>any(), Matchers.<ContentEncoder>any());
+ handler).outputReady(ArgumentMatchers.<NHttpClientConnection>any(), ArgumentMatchers.<ContentEncoder>any());
conn.produceOutput(handler);
@@ -188,7 +188,7 @@ public class TestDefaultNHttpClientConnection {
Assert.assertNull(conn.contentEncoder);
Assert.assertEquals("POST / HTTP/1.1\r\n\r\nstuff", wchannel.dump(Consts.ASCII));
- Mockito.verify(wchannel, Mockito.times(1)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(wchannel, Mockito.times(1)).write(ArgumentMatchers.<ByteBuffer>any());
}
@Test
@@ -205,7 +205,7 @@ public class TestDefaultNHttpClientConnection {
Assert.assertEquals(19, conn.outbuf.length());
Mockito.doAnswer(new ProduceContentAnswer(entity)).when(
- handler).outputReady(Matchers.<NHttpClientConnection>any(), Matchers.<ContentEncoder>any());
+ handler).outputReady(ArgumentMatchers.<NHttpClientConnection>any(), ArgumentMatchers.<ContentEncoder>any());
conn.produceOutput(handler);
@@ -213,7 +213,7 @@ public class TestDefaultNHttpClientConnection {
Assert.assertNull(conn.contentEncoder);
Assert.assertEquals("POST / HTTP/1.1\r\n\r\na lot of various stuff", wchannel.dump(Consts.ASCII));
- Mockito.verify(wchannel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(wchannel, Mockito.times(2)).write(ArgumentMatchers.<ByteBuffer>any());
}
@Test
@@ -227,10 +227,10 @@ public class TestDefaultNHttpClientConnection {
Mockito.when(session.channel()).thenReturn(channel);
Mockito.doAnswer(new RequestReadyAnswer(request)).when(
- handler).requestReady(Matchers.<NHttpClientConnection>any());
+ handler).requestReady(ArgumentMatchers.<NHttpClientConnection>any());
Mockito.doAnswer(new ProduceContentAnswer(entity)).when(
- handler).outputReady(Matchers.<NHttpClientConnection>any(), Matchers.<ContentEncoder>any());
+ handler).outputReady(ArgumentMatchers.<NHttpClientConnection>any(), ArgumentMatchers.<ContentEncoder>any());
conn.produceOutput(handler);
@@ -238,7 +238,7 @@ public class TestDefaultNHttpClientConnection {
Assert.assertNull(conn.contentEncoder);
Assert.assertEquals("POST / HTTP/1.1\r\n\r\nstuff", wchannel.dump(Consts.ASCII));
- Mockito.verify(wchannel, Mockito.times(1)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(wchannel, Mockito.times(1)).write(ArgumentMatchers.<ByteBuffer>any());
}
@Test
@@ -252,10 +252,10 @@ public class TestDefaultNHttpClientConnection {
Mockito.when(session.channel()).thenReturn(channel);
Mockito.doAnswer(new RequestReadyAnswer(request)).when(
- handler).requestReady(Matchers.<NHttpClientConnection>any());
+ handler).requestReady(ArgumentMatchers.<NHttpClientConnection>any());
Mockito.doAnswer(new ProduceContentAnswer(entity)).when(
- handler).outputReady(Matchers.<NHttpClientConnection>any(), Matchers.<ContentEncoder>any());
+ handler).outputReady(ArgumentMatchers.<NHttpClientConnection>any(), ArgumentMatchers.<ContentEncoder>any());
conn.produceOutput(handler);
@@ -263,7 +263,7 @@ public class TestDefaultNHttpClientConnection {
Assert.assertNull(conn.contentEncoder);
Assert.assertEquals("POST / HTTP/1.1\r\n\r\na lot of various stuff", wchannel.dump(Consts.ASCII));
- Mockito.verify(wchannel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(wchannel, Mockito.times(2)).write(ArgumentMatchers.<ByteBuffer>any());
}
@Test
@@ -277,10 +277,10 @@ public class TestDefaultNHttpClientConnection {
Mockito.when(session.channel()).thenReturn(channel);
Mockito.doAnswer(new RequestReadyAnswer(request)).when(
- handler).requestReady(Matchers.<NHttpClientConnection>any());
+ handler).requestReady(ArgumentMatchers.<NHttpClientConnection>any());
Mockito.doAnswer(new ProduceContentAnswer(entity)).when(
- handler).outputReady(Matchers.<NHttpClientConnection>any(), Matchers.<ContentEncoder>any());
+ handler).outputReady(ArgumentMatchers.<NHttpClientConnection>any(), ArgumentMatchers.<ContentEncoder>any());
conn.produceOutput(handler);
@@ -290,7 +290,7 @@ public class TestDefaultNHttpClientConnection {
Assert.assertEquals(17, conn.outbuf.length());
Mockito.verify(session, Mockito.never()).clearEvent(SelectionKey.OP_WRITE);
- Mockito.verify(wchannel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(wchannel, Mockito.times(2)).write(ArgumentMatchers.<ByteBuffer>any());
}
@Test
@@ -305,10 +305,10 @@ public class TestDefaultNHttpClientConnection {
Mockito.when(session.channel()).thenReturn(channel);
Mockito.doAnswer(new RequestReadyAnswer(request)).when(
- handler).requestReady(Matchers.<NHttpClientConnection>any());
+ handler).requestReady(ArgumentMatchers.<NHttpClientConnection>any());
Mockito.doAnswer(new ProduceContentAnswer(entity)).when(
- handler).outputReady(Matchers.<NHttpClientConnection>any(), Matchers.<ContentEncoder>any());
+ handler).outputReady(ArgumentMatchers.<NHttpClientConnection>any(), ArgumentMatchers.<ContentEncoder>any());
conn.produceOutput(handler);
@@ -317,7 +317,7 @@ public class TestDefaultNHttpClientConnection {
Assert.assertEquals("POST / HTTP/1.1\r\n\r\na loo", wchannel.dump(Consts.ASCII));
Mockito.verify(session, Mockito.never()).clearEvent(SelectionKey.OP_WRITE);
- Mockito.verify(wchannel, Mockito.times(3)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(wchannel, Mockito.times(3)).write(ArgumentMatchers.<ByteBuffer>any());
}
@Test
@@ -335,10 +335,10 @@ public class TestDefaultNHttpClientConnection {
Mockito.when(session.channel()).thenReturn(channel);
Mockito.doAnswer(new RequestReadyAnswer(request)).when(
- handler).requestReady(Matchers.<NHttpClientConnection>any());
+ handler).requestReady(ArgumentMatchers.<NHttpClientConnection>any());
Mockito.doAnswer(new ProduceContentAnswer(entity)).when(
- handler).outputReady(Matchers.<NHttpClientConnection>any(), Matchers.<ContentEncoder>any());
+ handler).outputReady(ArgumentMatchers.<NHttpClientConnection>any(), ArgumentMatchers.<ContentEncoder>any());
conn.produceOutput(handler);
@@ -347,7 +347,7 @@ public class TestDefaultNHttpClientConnection {
Assert.assertEquals("POST / HTTP/1.1\r\nTransfer-Encoding: chunked\r\n\r\n" +
"5\r\na lot\r\n11\r\n of various stuff\r\n0\r\n\r\n", wchannel.dump(Consts.ASCII));
- Mockito.verify(wchannel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(wchannel, Mockito.times(2)).write(ArgumentMatchers.<ByteBuffer>any());
}
@Test
@@ -365,10 +365,10 @@ public class TestDefaultNHttpClientConnection {
Mockito.when(session.channel()).thenReturn(channel);
Mockito.doAnswer(new RequestReadyAnswer(request)).when(
- handler).requestReady(Matchers.<NHttpClientConnection>any());
+ handler).requestReady(ArgumentMatchers.<NHttpClientConnection>any());
Mockito.doAnswer(new ProduceContentAnswer(entity)).when(
- handler).outputReady(Matchers.<NHttpClientConnection>any(), Matchers.<ContentEncoder>any());
+ handler).outputReady(ArgumentMatchers.<NHttpClientConnection>any(), ArgumentMatchers.<ContentEncoder>any());
conn.produceOutput(handler);
@@ -379,7 +379,7 @@ public class TestDefaultNHttpClientConnection {
Assert.assertEquals(21, conn.outbuf.length());
Mockito.verify(session, Mockito.never()).clearEvent(SelectionKey.OP_WRITE);
- Mockito.verify(wchannel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(wchannel, Mockito.times(2)).write(ArgumentMatchers.<ByteBuffer>any());
}
@Test
@@ -399,13 +399,13 @@ public class TestDefaultNHttpClientConnection {
Assert.assertEquals(NHttpConnection.CLOSED, conn.getStatus());
- Mockito.verify(wchannel, Mockito.times(1)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(wchannel, Mockito.times(1)).write(ArgumentMatchers.<ByteBuffer>any());
Mockito.verify(session, Mockito.times(1)).close();
Mockito.verify(session, Mockito.never()).clearEvent(SelectionKey.OP_WRITE);
Mockito.verify(handler, Mockito.never()).requestReady(
- Matchers.<NHttpClientConnection>any());
+ ArgumentMatchers.<NHttpClientConnection>any());
Mockito.verify(handler, Mockito.never()).outputReady(
- Matchers.<NHttpClientConnection>any(), Matchers.<ContentEncoder>any());
+ ArgumentMatchers.<NHttpClientConnection>any(), ArgumentMatchers.<ContentEncoder>any());
}
static class ResponseCapturingAnswer implements Answer<Void> {
@@ -462,9 +462,9 @@ public class TestDefaultNHttpClientConnection {
final LinkedList<HttpResponse> responses = new LinkedList<HttpResponse>();
Mockito.doAnswer(new ResponseCapturingAnswer(responses)).when(
- handler).responseReceived(Matchers.<NHttpClientConnection>any());
+ handler).responseReceived(ArgumentMatchers.<NHttpClientConnection>any());
Mockito.doAnswer(new ConsumeContentAnswer(new SimpleInputBuffer(64))).when(
- handler).inputReady(Matchers.<NHttpClientConnection>any(), Matchers.<ContentDecoder>any());
+ handler).inputReady(ArgumentMatchers.<NHttpClientConnection>any(), ArgumentMatchers.<ContentDecoder>any());
Assert.assertEquals(0, conn.getMetrics().getResponseCount());
@@ -476,12 +476,12 @@ public class TestDefaultNHttpClientConnection {
Assert.assertEquals(43, conn.getMetrics().getReceivedBytesCount());
Mockito.verify(handler, Mockito.times(1)).responseReceived(
- Matchers.<NHttpClientConnection>any());
+ ArgumentMatchers.<NHttpClientConnection>any());
Mockito.verify(handler, Mockito.times(1)).inputReady(
- Matchers.<NHttpClientConnection>any(), Matchers.<LengthDelimitedDecoder>any());
- Mockito.verify(rchannel, Mockito.times(2)).read(Matchers.<ByteBuffer>any());
+ ArgumentMatchers.<NHttpClientConnection>any(), ArgumentMatchers.<LengthDelimitedDecoder>any());
+ Mockito.verify(rchannel, Mockito.times(2)).read(ArgumentMatchers.<ByteBuffer>any());
Mockito.verify(handler, Mockito.never()).exception(
- Matchers.<NHttpClientConnection>any(), Matchers.<Exception>any());
+ ArgumentMatchers.<NHttpClientConnection>any(), ArgumentMatchers.<Exception>any());
Assert.assertFalse(responses.isEmpty());
final HttpResponse response = responses.getFirst();
@@ -507,9 +507,9 @@ public class TestDefaultNHttpClientConnection {
final LinkedList<HttpResponse> responses = new LinkedList<HttpResponse>();
Mockito.doAnswer(new ResponseCapturingAnswer(responses)).when(
- handler).responseReceived(Matchers.<NHttpClientConnection>any());
+ handler).responseReceived(ArgumentMatchers.<NHttpClientConnection>any());
Mockito.doAnswer(new ConsumeContentAnswer(new SimpleInputBuffer(64))).when(
- handler).inputReady(Matchers.<NHttpClientConnection>any(), Matchers.<ContentDecoder>any());
+ handler).inputReady(ArgumentMatchers.<NHttpClientConnection>any(), ArgumentMatchers.<ContentDecoder>any());
Assert.assertEquals(0, conn.getMetrics().getResponseCount());
@@ -521,12 +521,12 @@ public class TestDefaultNHttpClientConnection {
Assert.assertEquals(54, conn.getMetrics().getReceivedBytesCount());
Mockito.verify(handler, Mockito.times(1)).responseReceived(
- Matchers.<NHttpClientConnection>any());
+ ArgumentMatchers.<NHttpClientConnection>any());
Mockito.verify(handler, Mockito.times(1)).inputReady(
- Matchers.<NHttpClientConnection>any(), Matchers.<LengthDelimitedDecoder>any());
- Mockito.verify(rchannel, Mockito.times(2)).read(Matchers.<ByteBuffer>any());
+ ArgumentMatchers.<NHttpClientConnection>any(), ArgumentMatchers.<LengthDelimitedDecoder>any());
+ Mockito.verify(rchannel, Mockito.times(2)).read(ArgumentMatchers.<ByteBuffer>any());
Mockito.verify(handler, Mockito.never()).exception(
- Matchers.<NHttpClientConnection>any(), Matchers.<Exception>any());
+ ArgumentMatchers.<NHttpClientConnection>any(), ArgumentMatchers.<Exception>any());
Assert.assertFalse(responses.isEmpty());
final HttpResponse response = responses.getFirst();
@@ -543,9 +543,9 @@ public class TestDefaultNHttpClientConnection {
Assert.assertEquals(1, conn.getMetrics().getResponseCount());
Assert.assertEquals(54, conn.getMetrics().getReceivedBytesCount());
- Mockito.verify(rchannel, Mockito.times(3)).read(Matchers.<ByteBuffer>any());
+ Mockito.verify(rchannel, Mockito.times(3)).read(ArgumentMatchers.<ByteBuffer>any());
Mockito.verify(handler, Mockito.never()).exception(
- Matchers.<NHttpClientConnection>any(), Matchers.<Exception>any());
+ ArgumentMatchers.<NHttpClientConnection>any(), ArgumentMatchers.<Exception>any());
}
@Test
@@ -559,9 +559,9 @@ public class TestDefaultNHttpClientConnection {
final LinkedList<HttpResponse> responses = new LinkedList<HttpResponse>();
Mockito.doAnswer(new ResponseCapturingAnswer(responses)).when(
- handler).responseReceived(Matchers.<NHttpClientConnection>any());
+ handler).responseReceived(ArgumentMatchers.<NHttpClientConnection>any());
Mockito.doAnswer(new ConsumeContentAnswer(new SimpleInputBuffer(64))).when(
- handler).inputReady(Matchers.<NHttpClientConnection>any(), Matchers.<ContentDecoder>any());
+ handler).inputReady(ArgumentMatchers.<NHttpClientConnection>any(), ArgumentMatchers.<ContentDecoder>any());
conn.consumeInput(handler);
@@ -569,12 +569,12 @@ public class TestDefaultNHttpClientConnection {
Assert.assertNull(conn.contentDecoder);
Mockito.verify(handler, Mockito.times(1)).responseReceived(
- Matchers.<NHttpClientConnection>any());
+ ArgumentMatchers.<NHttpClientConnection>any());
Mockito.verify(handler, Mockito.never()).inputReady(
- Matchers.<NHttpClientConnection>any(), Matchers.<LengthDelimitedDecoder>any());
- Mockito.verify(rchannel, Mockito.times(1)).read(Matchers.<ByteBuffer>any());
+ ArgumentMatchers.<NHttpClientConnection>any(), ArgumentMatchers.<LengthDelimitedDecoder>any());
+ Mockito.verify(rchannel, Mockito.times(1)).read(ArgumentMatchers.<ByteBuffer>any());
Mockito.verify(handler, Mockito.never()).exception(
- Matchers.<NHttpClientConnection>any(), Matchers.<Exception>any());
+ ArgumentMatchers.<NHttpClientConnection>any(), ArgumentMatchers.<Exception>any());
Assert.assertFalse(responses.isEmpty());
final HttpResponse response = responses.getFirst();
@@ -597,9 +597,9 @@ public class TestDefaultNHttpClientConnection {
final LinkedList<HttpResponse> responses = new LinkedList<HttpResponse>();
Mockito.doAnswer(new ResponseCapturingAnswer(responses)).when(
- handler).responseReceived(Matchers.<NHttpClientConnection>any());
+ handler).responseReceived(ArgumentMatchers.<NHttpClientConnection>any());
Mockito.doAnswer(new ConsumeContentAnswer(new SimpleInputBuffer(64))).when(
- handler).inputReady(Matchers.<NHttpClientConnection>any(), Matchers.<ContentDecoder>any());
+ handler).inputReady(ArgumentMatchers.<NHttpClientConnection>any(), ArgumentMatchers.<ContentDecoder>any());
Assert.assertEquals(0, conn.getMetrics().getResponseCount());
@@ -611,12 +611,12 @@ public class TestDefaultNHttpClientConnection {
Assert.assertEquals(0, conn.getMetrics().getReceivedBytesCount());
Mockito.verify(handler, Mockito.never()).responseReceived(
- Matchers.<NHttpClientConnection>any());
+ ArgumentMatchers.<NHttpClientConnection>any());
Mockito.verify(handler, Mockito.never()).inputReady(
- Matchers.<NHttpClientConnection>any(), Matchers.<LengthDelimitedDecoder>any());
- Mockito.verify(rchannel, Mockito.times(1)).read(Matchers.<ByteBuffer>any());
+ ArgumentMatchers.<NHttpClientConnection>any(), ArgumentMatchers.<LengthDelimitedDecoder>any());
+ Mockito.verify(rchannel, Mockito.times(1)).read(ArgumentMatchers.<ByteBuffer>any());
Mockito.verify(handler, Mockito.never()).exception(
- Matchers.<NHttpClientConnection>any(), Matchers.<Exception>any());
+ ArgumentMatchers.<NHttpClientConnection>any(), ArgumentMatchers.<Exception>any());
conn.consumeInput(handler);
@@ -626,12 +626,12 @@ public class TestDefaultNHttpClientConnection {
Assert.assertEquals(0, conn.getMetrics().getReceivedBytesCount());
Mockito.verify(handler, Mockito.never()).responseReceived(
- Matchers.<NHttpClientConnection>any());
+ ArgumentMatchers.<NHttpClientConnection>any());
Mockito.verify(handler, Mockito.never()).inputReady(
- Matchers.<NHttpClientConnection>any(), Matchers.<LengthDelimitedDecoder>any());
- Mockito.verify(rchannel, Mockito.times(2)).read(Matchers.<ByteBuffer>any());
+ ArgumentMatchers.<NHttpClientConnection>any(), ArgumentMatchers.<LengthDelimitedDecoder>any());
+ Mockito.verify(rchannel, Mockito.times(2)).read(ArgumentMatchers.<ByteBuffer>any());
Mockito.verify(handler, Mockito.never()).exception(
- Matchers.<NHttpClientConnection>any(), Matchers.<Exception>any());
+ ArgumentMatchers.<NHttpClientConnection>any(), ArgumentMatchers.<Exception>any());
conn.consumeInput(handler);
Assert.assertNull(conn.getHttpResponse());
@@ -640,14 +640,14 @@ public class TestDefaultNHttpClientConnection {
Assert.assertEquals(0, conn.getMetrics().getReceivedBytesCount());
Mockito.verify(handler, Mockito.never()).responseReceived(
- Matchers.<NHttpClientConnection>any());
+ ArgumentMatchers.<NHttpClientConnection>any());
Mockito.verify(handler, Mockito.never()).inputReady(
- Matchers.<NHttpClientConnection>any(), Matchers.<LengthDelimitedDecoder>any());
- Mockito.verify(rchannel, Mockito.times(3)).read(Matchers.<ByteBuffer>any());
+ ArgumentMatchers.<NHttpClientConnection>any(), ArgumentMatchers.<LengthDelimitedDecoder>any());
+ Mockito.verify(rchannel, Mockito.times(3)).read(ArgumentMatchers.<ByteBuffer>any());
Mockito.verify(handler, Mockito.times(1)).endOfInput(
- Matchers.<NHttpClientConnection>any());
+ ArgumentMatchers.<NHttpClientConnection>any());
Mockito.verify(handler, Mockito.never()).exception(
- Matchers.<NHttpClientConnection>any(), Matchers.<Exception>any());
+ ArgumentMatchers.<NHttpClientConnection>any(), ArgumentMatchers.<Exception>any());
}
@@ -662,7 +662,7 @@ public class TestDefaultNHttpClientConnection {
conn.close();
conn.consumeInput(handler);
- Mockito.verify(rchannel, Mockito.never()).read(Matchers.<ByteBuffer>any());
+ Mockito.verify(rchannel, Mockito.never()).read(ArgumentMatchers.<ByteBuffer>any());
Mockito.verify(session, Mockito.times(1)).clearEvent(SelectionKey.OP_READ);
}
diff --git a/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpServerConnection.java b/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpServerConnection.java
index 334c941..3004f51 100644
--- a/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpServerConnection.java
+++ b/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpServerConnection.java
@@ -57,7 +57,7 @@ import org.apache.http.protocol.HTTP;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.mockito.Matchers;
+import org.mockito.ArgumentMatchers;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
@@ -180,7 +180,7 @@ public class TestDefaultNHttpServerConnection {
Assert.assertEquals(19, conn.outbuf.length());
Mockito.doAnswer(new ProduceContentAnswer(entity)).when(
- handler).outputReady(Matchers.<NHttpServerConnection>any(), Matchers.<ContentEncoder>any());
+ handler).outputReady(ArgumentMatchers.<NHttpServerConnection>any(), ArgumentMatchers.<ContentEncoder>any());
conn.produceOutput(handler);
@@ -188,7 +188,7 @@ public class TestDefaultNHttpServerConnection {
Assert.assertNull(conn.contentEncoder);
Assert.assertEquals("HTTP/1.1 200 OK\r\n\r\nstuff", wchannel.dump(Consts.ASCII));
- Mockito.verify(wchannel, Mockito.times(1)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(wchannel, Mockito.times(1)).write(ArgumentMatchers.<ByteBuffer>any());
}
@Test
@@ -205,7 +205,7 @@ public class TestDefaultNHttpServerConnection {
Assert.assertEquals(19, conn.outbuf.length());
Mockito.doAnswer(new ProduceContentAnswer(entity)).when(
- handler).outputReady(Matchers.<NHttpServerConnection>any(), Matchers.<ContentEncoder>any());
+ handler).outputReady(ArgumentMatchers.<NHttpServerConnection>any(), ArgumentMatchers.<ContentEncoder>any());
conn.produceOutput(handler);
@@ -213,7 +213,7 @@ public class TestDefaultNHttpServerConnection {
Assert.assertNull(conn.contentEncoder);
Assert.assertEquals("HTTP/1.1 200 OK\r\n\r\na lot of various stuff", wchannel.dump(Consts.ASCII));
- Mockito.verify(wchannel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(wchannel, Mockito.times(2)).write(ArgumentMatchers.<ByteBuffer>any());
}
@Test
@@ -227,10 +227,10 @@ public class TestDefaultNHttpServerConnection {
Mockito.when(session.channel()).thenReturn(channel);
Mockito.doAnswer(new ResponseReadyAnswer(response)).when(
- handler).responseReady(Matchers.<NHttpServerConnection>any());
+ handler).responseReady(ArgumentMatchers.<NHttpServerConnection>any());
Mockito.doAnswer(new ProduceContentAnswer(entity)).when(
- handler).outputReady(Matchers.<NHttpServerConnection>any(), Matchers.<ContentEncoder>any());
+ handler).outputReady(ArgumentMatchers.<NHttpServerConnection>any(), ArgumentMatchers.<ContentEncoder>any());
conn.produceOutput(handler);
@@ -238,7 +238,7 @@ public class TestDefaultNHttpServerConnection {
Assert.assertNull(conn.contentEncoder);
Assert.assertEquals("HTTP/1.1 200 OK\r\n\r\nstuff", wchannel.dump(Consts.ASCII));
- Mockito.verify(wchannel, Mockito.times(1)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(wchannel, Mockito.times(1)).write(ArgumentMatchers.<ByteBuffer>any());
}
@Test
@@ -252,10 +252,10 @@ public class TestDefaultNHttpServerConnection {
Mockito.when(session.channel()).thenReturn(channel);
Mockito.doAnswer(new ResponseReadyAnswer(response)).when(
- handler).responseReady(Matchers.<NHttpServerConnection>any());
+ handler).responseReady(ArgumentMatchers.<NHttpServerConnection>any());
Mockito.doAnswer(new ProduceContentAnswer(entity)).when(
- handler).outputReady(Matchers.<NHttpServerConnection>any(), Matchers.<ContentEncoder>any());
+ handler).outputReady(ArgumentMatchers.<NHttpServerConnection>any(), ArgumentMatchers.<ContentEncoder>any());
conn.produceOutput(handler);
@@ -263,7 +263,7 @@ public class TestDefaultNHttpServerConnection {
Assert.assertNull(conn.contentEncoder);
Assert.assertEquals("HTTP/1.1 200 OK\r\n\r\na lot of various stuff", wchannel.dump(Consts.ASCII));
- Mockito.verify(wchannel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(wchannel, Mockito.times(2)).write(ArgumentMatchers.<ByteBuffer>any());
}
@Test
@@ -277,10 +277,10 @@ public class TestDefaultNHttpServerConnection {
Mockito.when(session.channel()).thenReturn(channel);
Mockito.doAnswer(new ResponseReadyAnswer(response)).when(
- handler).responseReady(Matchers.<NHttpServerConnection>any());
+ handler).responseReady(ArgumentMatchers.<NHttpServerConnection>any());
Mockito.doAnswer(new ProduceContentAnswer(entity)).when(
- handler).outputReady(Matchers.<NHttpServerConnection>any(), Matchers.<ContentEncoder>any());
+ handler).outputReady(ArgumentMatchers.<NHttpServerConnection>any(), ArgumentMatchers.<ContentEncoder>any());
conn.produceOutput(handler);
@@ -290,7 +290,7 @@ public class TestDefaultNHttpServerConnection {
Assert.assertEquals(17, conn.outbuf.length());
Mockito.verify(session, Mockito.never()).clearEvent(SelectionKey.OP_WRITE);
- Mockito.verify(wchannel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(wchannel, Mockito.times(2)).write(ArgumentMatchers.<ByteBuffer>any());
}
@Test
@@ -305,10 +305,10 @@ public class TestDefaultNHttpServerConnection {
Mockito.when(session.channel()).thenReturn(channel);
Mockito.doAnswer(new ResponseReadyAnswer(response)).when(
- handler).responseReady(Matchers.<NHttpServerConnection>any());
+ handler).responseReady(ArgumentMatchers.<NHttpServerConnection>any());
Mockito.doAnswer(new ProduceContentAnswer(entity)).when(
- handler).outputReady(Matchers.<NHttpServerConnection>any(), Matchers.<ContentEncoder>any());
+ handler).outputReady(ArgumentMatchers.<NHttpServerConnection>any(), ArgumentMatchers.<ContentEncoder>any());
conn.produceOutput(handler);
@@ -317,7 +317,7 @@ public class TestDefaultNHttpServerConnection {
Assert.assertEquals("HTTP/1.1 200 OK\r\n\r\na loo", wchannel.dump(Consts.ASCII));
Mockito.verify(session, Mockito.never()).clearEvent(SelectionKey.OP_WRITE);
- Mockito.verify(wchannel, Mockito.times(3)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(wchannel, Mockito.times(3)).write(ArgumentMatchers.<ByteBuffer>any());
}
@Test
@@ -335,10 +335,10 @@ public class TestDefaultNHttpServerConnection {
Mockito.when(session.channel()).thenReturn(channel);
Mockito.doAnswer(new ResponseReadyAnswer(response)).when(
- handler).responseReady(Matchers.<NHttpServerConnection>any());
+ handler).responseReady(ArgumentMatchers.<NHttpServerConnection>any());
Mockito.doAnswer(new ProduceContentAnswer(entity)).when(
- handler).outputReady(Matchers.<NHttpServerConnection>any(), Matchers.<ContentEncoder>any());
+ handler).outputReady(ArgumentMatchers.<NHttpServerConnection>any(), ArgumentMatchers.<ContentEncoder>any());
conn.produceOutput(handler);
@@ -347,7 +347,7 @@ public class TestDefaultNHttpServerConnection {
Assert.assertEquals("HTTP/1.1 200 OK\r\nTransfer-Encoding: chunked\r\n\r\n" +
"5\r\na lot\r\n11\r\n of various stuff\r\n0\r\n\r\n", wchannel.dump(Consts.ASCII));
- Mockito.verify(wchannel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(wchannel, Mockito.times(2)).write(ArgumentMatchers.<ByteBuffer>any());
}
@Test
@@ -365,10 +365,10 @@ public class TestDefaultNHttpServerConnection {
Mockito.when(session.channel()).thenReturn(channel);
Mockito.doAnswer(new ResponseReadyAnswer(response)).when(
- handler).responseReady(Matchers.<NHttpServerConnection>any());
+ handler).responseReady(ArgumentMatchers.<NHttpServerConnection>any());
Mockito.doAnswer(new ProduceContentAnswer(entity)).when(
- handler).outputReady(Matchers.<NHttpServerConnection>any(), Matchers.<ContentEncoder>any());
+ handler).outputReady(ArgumentMatchers.<NHttpServerConnection>any(), ArgumentMatchers.<ContentEncoder>any());
conn.produceOutput(handler);
@@ -379,7 +379,7 @@ public class TestDefaultNHttpServerConnection {
Assert.assertEquals(21, conn.outbuf.length());
Mockito.verify(session, Mockito.never()).clearEvent(SelectionKey.OP_WRITE);
- Mockito.verify(wchannel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(wchannel, Mockito.times(2)).write(ArgumentMatchers.<ByteBuffer>any());
}
@Test
@@ -399,13 +399,13 @@ public class TestDefaultNHttpServerConnection {
Assert.assertEquals(NHttpConnection.CLOSED, conn.getStatus());
- Mockito.verify(wchannel, Mockito.times(1)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(wchannel, Mockito.times(1)).write(ArgumentMatchers.<ByteBuffer>any());
Mockito.verify(session, Mockito.times(1)).close();
Mockito.verify(session, Mockito.never()).clearEvent(SelectionKey.OP_WRITE);
Mockito.verify(handler, Mockito.never()).responseReady(
- Matchers.<NHttpServerConnection>any());
+ ArgumentMatchers.<NHttpServerConnection>any());
Mockito.verify(handler, Mockito.never()).outputReady(
- Matchers.<NHttpServerConnection>any(), Matchers.<ContentEncoder>any());
+ ArgumentMatchers.<NHttpServerConnection>any(), ArgumentMatchers.<ContentEncoder>any());
}
static class RequestCapturingAnswer implements Answer<Void> {
@@ -462,9 +462,9 @@ public class TestDefaultNHttpServerConnection {
final LinkedList<HttpRequest> requests = new LinkedList<HttpRequest>();
Mockito.doAnswer(new RequestCapturingAnswer(requests)).when(
- handler).requestReceived(Matchers.<NHttpServerConnection>any());
+ handler).requestReceived(ArgumentMatchers.<NHttpServerConnection>any());
Mockito.doAnswer(new ConsumeContentAnswer(new SimpleInputBuffer(64))).when(
- handler).inputReady(Matchers.<NHttpServerConnection>any(), Matchers.<ContentDecoder>any());
+ handler).inputReady(ArgumentMatchers.<NHttpServerConnection>any(), ArgumentMatchers.<ContentDecoder>any());
Assert.assertEquals(0, conn.getMetrics().getRequestCount());
@@ -476,12 +476,12 @@ public class TestDefaultNHttpServerConnection {
Assert.assertEquals(43, conn.getMetrics().getReceivedBytesCount());
Mockito.verify(handler, Mockito.times(1)).requestReceived(
- Matchers.<NHttpServerConnection>any());
+ ArgumentMatchers.<NHttpServerConnection>any());
Mockito.verify(handler, Mockito.times(1)).inputReady(
- Matchers.<NHttpServerConnection>any(), Matchers.<LengthDelimitedDecoder>any());
- Mockito.verify(rchannel, Mockito.times(2)).read(Matchers.<ByteBuffer>any());
+ ArgumentMatchers.<NHttpServerConnection>any(), ArgumentMatchers.<LengthDelimitedDecoder>any());
+ Mockito.verify(rchannel, Mockito.times(2)).read(ArgumentMatchers.<ByteBuffer>any());
Mockito.verify(handler, Mockito.never()).exception(
- Matchers.<NHttpServerConnection>any(), Matchers.<Exception>any());
+ ArgumentMatchers.<NHttpServerConnection>any(), ArgumentMatchers.<Exception>any());
Assert.assertFalse(requests.isEmpty());
final HttpRequest request = requests.getFirst();
@@ -508,9 +508,9 @@ public class TestDefaultNHttpServerConnection {
final LinkedList<HttpRequest> requests = new LinkedList<HttpRequest>();
Mockito.doAnswer(new RequestCapturingAnswer(requests)).when(
- handler).requestReceived(Matchers.<NHttpServerConnection>any());
+ handler).requestReceived(ArgumentMatchers.<NHttpServerConnection>any());
Mockito.doAnswer(new ConsumeContentAnswer(new SimpleInputBuffer(64))).when(
- handler).inputReady(Matchers.<NHttpServerConnection>any(), Matchers.<ContentDecoder>any());
+ handler).inputReady(ArgumentMatchers.<NHttpServerConnection>any(), ArgumentMatchers.<ContentDecoder>any());
Assert.assertEquals(0, conn.getMetrics().getResponseCount());
@@ -522,12 +522,12 @@ public class TestDefaultNHttpServerConnection {
Assert.assertEquals(54, conn.getMetrics().getReceivedBytesCount());
Mockito.verify(handler, Mockito.times(1)).requestReceived(
- Matchers.<NHttpServerConnection>any());
+ ArgumentMatchers.<NHttpServerConnection>any());
Mockito.verify(handler, Mockito.times(1)).inputReady(
- Matchers.<NHttpServerConnection>any(), Matchers.<LengthDelimitedDecoder>any());
- Mockito.verify(rchannel, Mockito.times(2)).read(Matchers.<ByteBuffer>any());
+ ArgumentMatchers.<NHttpServerConnection>any(), ArgumentMatchers.<LengthDelimitedDecoder>any());
+ Mockito.verify(rchannel, Mockito.times(2)).read(ArgumentMatchers.<ByteBuffer>any());
Mockito.verify(handler, Mockito.never()).exception(
- Matchers.<NHttpServerConnection>any(), Matchers.<Exception>any());
+ ArgumentMatchers.<NHttpServerConnection>any(), ArgumentMatchers.<Exception>any());
Assert.assertFalse(requests.isEmpty());
final HttpRequest request = requests.getFirst();
@@ -545,9 +545,9 @@ public class TestDefaultNHttpServerConnection {
Assert.assertEquals(1, conn.getMetrics().getRequestCount());
Assert.assertEquals(54, conn.getMetrics().getReceivedBytesCount());
- Mockito.verify(rchannel, Mockito.times(3)).read(Matchers.<ByteBuffer>any());
+ Mockito.verify(rchannel, Mockito.times(3)).read(ArgumentMatchers.<ByteBuffer>any());
Mockito.verify(handler, Mockito.never()).exception(
- Matchers.<NHttpServerConnection>any(), Matchers.<Exception>any());
+ ArgumentMatchers.<NHttpServerConnection>any(), ArgumentMatchers.<Exception>any());
}
@Test
@@ -561,9 +561,9 @@ public class TestDefaultNHttpServerConnection {
final LinkedList<HttpRequest> requests = new LinkedList<HttpRequest>();
Mockito.doAnswer(new RequestCapturingAnswer(requests)).when(
- handler).requestReceived(Matchers.<NHttpServerConnection>any());
+ handler).requestReceived(ArgumentMatchers.<NHttpServerConnection>any());
Mockito.doAnswer(new ConsumeContentAnswer(new SimpleInputBuffer(64))).when(
- handler).inputReady(Matchers.<NHttpServerConnection>any(), Matchers.<ContentDecoder>any());
+ handler).inputReady(ArgumentMatchers.<NHttpServerConnection>any(), ArgumentMatchers.<ContentDecoder>any());
conn.consumeInput(handler);
@@ -571,12 +571,12 @@ public class TestDefaultNHttpServerConnection {
Assert.assertNull(conn.contentDecoder);
Mockito.verify(handler, Mockito.times(1)).requestReceived(
- Matchers.<NHttpServerConnection>any());
+ ArgumentMatchers.<NHttpServerConnection>any());
Mockito.verify(handler, Mockito.never()).inputReady(
- Matchers.<NHttpServerConnection>any(), Matchers.<LengthDelimitedDecoder>any());
- Mockito.verify(rchannel, Mockito.times(1)).read(Matchers.<ByteBuffer>any());
+ ArgumentMatchers.<NHttpServerConnection>any(), ArgumentMatchers.<LengthDelimitedDecoder>any());
+ Mockito.verify(rchannel, Mockito.times(1)).read(ArgumentMatchers.<ByteBuffer>any());
Mockito.verify(handler, Mockito.never()).exception(
- Matchers.<NHttpServerConnection>any(), Matchers.<Exception>any());
+ ArgumentMatchers.<NHttpServerConnection>any(), ArgumentMatchers.<Exception>any());
Assert.assertFalse(requests.isEmpty());
final HttpRequest request = requests.getFirst();
@@ -599,9 +599,9 @@ public class TestDefaultNHttpServerConnection {
final LinkedList<HttpRequest> requests = new LinkedList<HttpRequest>();
Mockito.doAnswer(new RequestCapturingAnswer(requests)).when(
- handler).requestReceived(Matchers.<NHttpServerConnection>any());
+ handler).requestReceived(ArgumentMatchers.<NHttpServerConnection>any());
Mockito.doAnswer(new ConsumeContentAnswer(new SimpleInputBuffer(64))).when(
- handler).inputReady(Matchers.<NHttpServerConnection>any(), Matchers.<ContentDecoder>any());
+ handler).inputReady(ArgumentMatchers.<NHttpServerConnection>any(), ArgumentMatchers.<ContentDecoder>any());
Assert.assertEquals(0, conn.getMetrics().getResponseCount());
@@ -613,12 +613,12 @@ public class TestDefaultNHttpServerConnection {
Assert.assertEquals(0, conn.getMetrics().getReceivedBytesCount());
Mockito.verify(handler, Mockito.never()).requestReceived(
- Matchers.<NHttpServerConnection>any());
+ ArgumentMatchers.<NHttpServerConnection>any());
Mockito.verify(handler, Mockito.never()).inputReady(
- Matchers.<NHttpServerConnection>any(), Matchers.<LengthDelimitedDecoder>any());
- Mockito.verify(rchannel, Mockito.times(1)).read(Matchers.<ByteBuffer>any());
+ ArgumentMatchers.<NHttpServerConnection>any(), ArgumentMatchers.<LengthDelimitedDecoder>any());
+ Mockito.verify(rchannel, Mockito.times(1)).read(ArgumentMatchers.<ByteBuffer>any());
Mockito.verify(handler, Mockito.never()).exception(
- Matchers.<NHttpServerConnection>any(), Matchers.<Exception>any());
+ ArgumentMatchers.<NHttpServerConnection>any(), ArgumentMatchers.<Exception>any());
conn.consumeInput(handler);
@@ -628,12 +628,12 @@ public class TestDefaultNHttpServerConnection {
Assert.assertEquals(0, conn.getMetrics().getReceivedBytesCount());
Mockito.verify(handler, Mockito.never()).requestReceived(
- Matchers.<NHttpServerConnection>any());
+ ArgumentMatchers.<NHttpServerConnection>any());
Mockito.verify(handler, Mockito.never()).inputReady(
- Matchers.<NHttpServerConnection>any(), Matchers.<LengthDelimitedDecoder>any());
- Mockito.verify(rchannel, Mockito.times(2)).read(Matchers.<ByteBuffer>any());
+ ArgumentMatchers.<NHttpServerConnection>any(), ArgumentMatchers.<LengthDelimitedDecoder>any());
+ Mockito.verify(rchannel, Mockito.times(2)).read(ArgumentMatchers.<ByteBuffer>any());
Mockito.verify(handler, Mockito.never()).exception(
- Matchers.<NHttpServerConnection>any(), Matchers.<Exception>any());
+ ArgumentMatchers.<NHttpServerConnection>any(), ArgumentMatchers.<Exception>any());
conn.consumeInput(handler);
Assert.assertNull(conn.getHttpResponse());
@@ -642,14 +642,14 @@ public class TestDefaultNHttpServerConnection {
Assert.assertEquals(0, conn.getMetrics().getReceivedBytesCount());
Mockito.verify(handler, Mockito.never()).requestReceived(
- Matchers.<NHttpServerConnection>any());
+ ArgumentMatchers.<NHttpServerConnection>any());
Mockito.verify(handler, Mockito.never()).inputReady(
- Matchers.<NHttpServerConnection>any(), Matchers.<LengthDelimitedDecoder>any());
- Mockito.verify(rchannel, Mockito.times(3)).read(Matchers.<ByteBuffer>any());
+ ArgumentMatchers.<NHttpServerConnection>any(), ArgumentMatchers.<LengthDelimitedDecoder>any());
+ Mockito.verify(rchannel, Mockito.times(3)).read(ArgumentMatchers.<ByteBuffer>any());
Mockito.verify(handler, Mockito.times(1)).endOfInput(
- Matchers.<NHttpServerConnection>any());
+ ArgumentMatchers.<NHttpServerConnection>any());
Mockito.verify(handler, Mockito.never()).exception(
- Matchers.<NHttpServerConnection>any(), Matchers.<Exception>any());
+ ArgumentMatchers.<NHttpServerConnection>any(), ArgumentMatchers.<Exception>any());
}
@@ -664,7 +664,7 @@ public class TestDefaultNHttpServerConnection {
conn.close();
conn.consumeInput(handler);
- Mockito.verify(rchannel, Mockito.never()).read(Matchers.<ByteBuffer>any());
+ Mockito.verify(rchannel, Mockito.never()).read(ArgumentMatchers.<ByteBuffer>any());
Mockito.verify(session, Mockito.times(1)).clearEvent(SelectionKey.OP_READ);
}
diff --git a/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestChunkEncoder.java b/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestChunkEncoder.java
index d63f2d6..0d79ec6 100644
--- a/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestChunkEncoder.java
+++ b/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestChunkEncoder.java
@@ -36,7 +36,7 @@ import org.apache.http.impl.nio.reactor.SessionOutputBufferImpl;
import org.apache.http.nio.reactor.SessionOutputBuffer;
import org.junit.Assert;
import org.junit.Test;
-import org.mockito.Matchers;
+import org.mockito.ArgumentMatchers;
import org.mockito.Mockito;
/**
@@ -126,7 +126,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(Consts.ASCII);
diff --git a/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestIdentityEncoder.java b/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestIdentityEncoder.java
index ccdcb5e..1eb721c 100644
--- a/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestIdentityEncoder.java
+++ b/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestIdentityEncoder.java
@@ -41,7 +41,7 @@ import org.apache.http.nio.reactor.SessionOutputBuffer;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
-import org.mockito.Matchers;
+import org.mockito.ArgumentMatchers;
import org.mockito.Mockito;
/**
@@ -312,8 +312,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());
@@ -334,8 +334,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());
@@ -357,8 +357,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());
@@ -379,8 +379,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());
@@ -403,8 +403,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());
@@ -428,8 +428,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());
@@ -455,8 +455,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());
@@ -477,8 +477,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());
@@ -500,8 +500,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());
@@ -530,8 +530,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());
@@ -555,8 +555,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());
diff --git a/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestLengthDelimitedEncoder.java b/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestLengthDelimitedEncoder.java
index 71e0515..129cd37 100644
--- a/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestLengthDelimitedEncoder.java
+++ b/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestLengthDelimitedEncoder.java
@@ -41,7 +41,7 @@ import org.apache.http.nio.reactor.SessionOutputBuffer;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
-import org.mockito.Matchers;
+import org.mockito.ArgumentMatchers;
import org.mockito.Mockito;
/**
@@ -371,8 +371,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());
@@ -394,8 +394,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());
@@ -418,8 +418,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());
@@ -442,8 +442,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());
@@ -465,8 +465,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());
@@ -490,8 +490,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());
@@ -516,8 +516,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());
@@ -544,8 +544,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());
@@ -567,8 +567,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());
@@ -591,8 +591,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());
@@ -622,8 +622,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());
@@ -648,8 +648,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());
diff --git a/httpcore-nio/src/test/java/org/apache/http/impl/nio/pool/TestBasicNIOConnPool.java b/httpcore-nio/src/test/java/org/apache/http/impl/nio/pool/TestBasicNIOConnPool.java
index ee277c6..72e0193 100644
--- a/httpcore-nio/src/test/java/org/apache/http/impl/nio/pool/TestBasicNIOConnPool.java
+++ b/httpcore-nio/src/test/java/org/apache/http/impl/nio/pool/TestBasicNIOConnPool.java
@@ -38,7 +38,7 @@ import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.mockito.Matchers;
+import org.mockito.ArgumentMatchers;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
@@ -114,10 +114,10 @@ public class TestBasicNIOConnPool {
Mockito.when(sessionRequest.getSession()).thenReturn(session);
Mockito.when(sessionRequest.getAttachment()).thenReturn(host);
Mockito.when(reactor.connect(
- Matchers.any(SocketAddress.class),
- Matchers.<SocketAddress>isNull(),
- Matchers.eq(host),
- Matchers.any(SessionRequestCallback.class))).
+ ArgumentMatchers.any(SocketAddress.class),
+ ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.eq(host),
+ ArgumentMatchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest);
Mockito.when(session.getSocketTimeout()).thenReturn(999);
diff --git a/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java b/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java
index 20f230a..9322b6e 100644
--- a/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java
+++ b/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java
@@ -48,7 +48,7 @@ import org.apache.http.pool.PoolEntry;
import org.apache.http.pool.PoolStats;
import org.junit.Assert;
import org.junit.Test;
-import org.mockito.Matchers;
+import org.mockito.ArgumentMatchers;
import org.mockito.Mockito;
public class TestNIOConnPool {
@@ -175,9 +175,9 @@ public class TestNIOConnPool {
Mockito.when(sessionRequest.getSession()).thenReturn(ioSession);
final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioReactor.connect(
- Matchers.any(SocketAddress.class),
- Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class))).
+ ArgumentMatchers.any(SocketAddress.class),
+ ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest);
final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 10);
final Future<LocalPoolEntry> future = pool.lease("somehost", null, 100, TimeUnit.MILLISECONDS, null);
@@ -208,9 +208,9 @@ public class TestNIOConnPool {
Mockito.when(sessionRequest.getException()).thenReturn(new IOException());
final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioReactor.connect(
- Matchers.any(SocketAddress.class),
- Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class))).
+ ArgumentMatchers.any(SocketAddress.class),
+ ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest);
final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 10);
final Future<LocalPoolEntry> future = pool.lease("somehost", null);
@@ -245,9 +245,9 @@ public class TestNIOConnPool {
Mockito.when(sessionRequest.getSession()).thenReturn(ioSession);
final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioReactor.connect(
- Matchers.any(SocketAddress.class),
- Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class))).
+ ArgumentMatchers.any(SocketAddress.class),
+ ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest);
Mockito.when(ioReactor.getStatus()).thenReturn(IOReactorStatus.ACTIVE);
final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 10);
@@ -284,9 +284,9 @@ public class TestNIOConnPool {
Mockito.when(sessionRequest.getSession()).thenReturn(ioSession);
final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioReactor.connect(
- Matchers.any(SocketAddress.class),
- Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class))).
+ ArgumentMatchers.any(SocketAddress.class),
+ ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest);
final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 10);
final Future<LocalPoolEntry> future = pool.lease("somehost", null);
@@ -349,14 +349,14 @@ public class TestNIOConnPool {
final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioReactor.connect(
- Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class))).
+ ArgumentMatchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1);
Mockito.when(ioReactor.connect(
- Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
- Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class))).
+ ArgumentMatchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
+ ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest2);
final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 10);
@@ -423,14 +423,14 @@ public class TestNIOConnPool {
final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioReactor.connect(
- Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class))).
+ ArgumentMatchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1);
Mockito.when(ioReactor.connect(
- Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
- Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class))).
+ ArgumentMatchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
+ ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest2);
final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 10);
@@ -482,8 +482,8 @@ public class TestNIOConnPool {
Assert.assertFalse(future9.isDone());
Mockito.verify(ioReactor, Mockito.times(3)).connect(
- Matchers.any(SocketAddress.class), Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class));
+ ArgumentMatchers.any(SocketAddress.class), ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class));
pool.release(entry4, true);
pool.release(entry5, false);
@@ -494,8 +494,8 @@ public class TestNIOConnPool {
Assert.assertTrue(future9.isDone());
Mockito.verify(ioReactor, Mockito.times(4)).connect(
- Matchers.any(SocketAddress.class), Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class));
+ ArgumentMatchers.any(SocketAddress.class), ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class));
}
@Test
@@ -522,14 +522,14 @@ public class TestNIOConnPool {
final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioReactor.connect(
- Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class))).
+ ArgumentMatchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1, sessionRequest2, sessionRequest1);
Mockito.when(ioReactor.connect(
- Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
- Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class))).
+ ArgumentMatchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
+ ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest3, sessionRequest4, sessionRequest3);
final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 10);
@@ -543,14 +543,14 @@ public class TestNIOConnPool {
final Future<LocalPoolEntry> future4 = pool.lease("otherhost", null);
Mockito.verify(ioReactor, Mockito.times(2)).connect(
- Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class));
+ ArgumentMatchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class));
Mockito.verify(ioReactor, Mockito.never()).connect(
- Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
- Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class));
+ ArgumentMatchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
+ ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class));
pool.requestCompleted(sessionRequest1);
pool.requestCompleted(sessionRequest2);
@@ -574,14 +574,14 @@ public class TestNIOConnPool {
pool.release(entry2, true);
Mockito.verify(ioReactor, Mockito.times(2)).connect(
- Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class));
+ ArgumentMatchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class));
Mockito.verify(ioReactor, Mockito.times(2)).connect(
- Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
- Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class));
+ ArgumentMatchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
+ ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class));
pool.requestCompleted(sessionRequest3);
pool.requestCompleted(sessionRequest4);
@@ -602,27 +602,27 @@ public class TestNIOConnPool {
final Future<LocalPoolEntry> future6 = pool.lease("otherhost", null);
Mockito.verify(ioReactor, Mockito.times(2)).connect(
- Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class));
+ ArgumentMatchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class));
Mockito.verify(ioReactor, Mockito.times(2)).connect(
- Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
- Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class));
+ ArgumentMatchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
+ ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class));
pool.release(entry3, true);
pool.release(entry4, true);
Mockito.verify(ioReactor, Mockito.times(3)).connect(
- Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class));
+ ArgumentMatchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class));
Mockito.verify(ioReactor, Mockito.times(2)).connect(
- Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
- Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class));
+ ArgumentMatchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
+ ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class));
pool.requestCompleted(sessionRequest1);
@@ -642,14 +642,14 @@ public class TestNIOConnPool {
pool.release(entry6, true);
Mockito.verify(ioReactor, Mockito.times(3)).connect(
- Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class));
+ ArgumentMatchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class));
Mockito.verify(ioReactor, Mockito.times(2)).connect(
- Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
- Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class));
+ ArgumentMatchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
+ ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class));
totals = pool.getTotalStats();
Assert.assertEquals(2, totals.getAvailable());
@@ -676,9 +676,9 @@ public class TestNIOConnPool {
final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioReactor.connect(
- Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class))).
+ ArgumentMatchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1, sessionRequest2, sessionRequest3);
final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 10);
@@ -689,9 +689,9 @@ public class TestNIOConnPool {
final Future<LocalPoolEntry> future2 = pool.lease("somehost", null);
Mockito.verify(ioReactor, Mockito.times(2)).connect(
- Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class));
+ ArgumentMatchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class));
pool.requestCompleted(sessionRequest1);
pool.requestCompleted(sessionRequest2);
@@ -724,9 +724,9 @@ public class TestNIOConnPool {
Assert.assertNotNull(entry4);
Mockito.verify(ioReactor, Mockito.times(2)).connect(
- Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class));
+ ArgumentMatchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class));
pool.release(entry3, true);
pool.release(entry4, true);
@@ -741,9 +741,9 @@ public class TestNIOConnPool {
Assert.assertFalse(future5.isDone());
Mockito.verify(ioReactor, Mockito.times(3)).connect(
- Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class));
+ ArgumentMatchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class));
Mockito.verify(ioSession2).close();
Mockito.verify(ioSession1, Mockito.never()).close();
@@ -764,9 +764,9 @@ public class TestNIOConnPool {
final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioReactor.connect(
- Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class))).
+ ArgumentMatchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1);
final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 2);
@@ -774,8 +774,8 @@ public class TestNIOConnPool {
final Future<LocalPoolEntry> future1 = pool.lease("somehost", null);
Mockito.verify(ioReactor, Mockito.times(1)).connect(
- Matchers.any(SocketAddress.class), Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class));
+ ArgumentMatchers.any(SocketAddress.class), ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class));
pool.requestCompleted(sessionRequest1);
@@ -794,8 +794,8 @@ public class TestNIOConnPool {
Mockito.verify(ioSession1).close();
Mockito.verify(ioReactor, Mockito.times(2)).connect(
- Matchers.any(SocketAddress.class), Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class));
+ ArgumentMatchers.any(SocketAddress.class), ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class));
final PoolStats totals = pool.getTotalStats();
Assert.assertEquals(0, totals.getAvailable());
@@ -823,8 +823,8 @@ public class TestNIOConnPool {
final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioReactor.connect(
- Matchers.any(SocketAddress.class), Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class))).
+ ArgumentMatchers.any(SocketAddress.class), ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1, sessionRequest2);
final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 2);
@@ -879,8 +879,8 @@ public class TestNIOConnPool {
final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioReactor.connect(
- Matchers.any(SocketAddress.class), Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class))).
+ ArgumentMatchers.any(SocketAddress.class), ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1, sessionRequest2);
final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 2);
@@ -944,8 +944,8 @@ public class TestNIOConnPool {
final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioReactor.connect(
- Matchers.any(SocketAddress.class), Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class))).
+ ArgumentMatchers.any(SocketAddress.class), ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1);
final LocalSessionPool pool = new LocalSessionPool(ioReactor, 1, 1);
@@ -1048,8 +1048,8 @@ public class TestNIOConnPool {
final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioReactor.connect(
- Matchers.any(SocketAddress.class), Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class))).
+ ArgumentMatchers.any(SocketAddress.class), ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1);
Mockito.when(ioReactor.getStatus()).thenReturn(IOReactorStatus.ACTIVE);
@@ -1082,8 +1082,8 @@ public class TestNIOConnPool {
final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioReactor.connect(
- Matchers.any(SocketAddress.class), Matchers.<SocketAddress>isNull(),
- Matchers.any(), Matchers.any(SessionRequestCallback.class))).
+ ArgumentMatchers.any(SocketAddress.class), ArgumentMatchers.<SocketAddress>isNull(),
+ ArgumentMatchers.any(), ArgumentMatchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1);
Mockito.when(ioReactor.getStatus()).thenReturn(IOReactorStatus.ACTIVE);
diff --git a/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncClientExchangeHandler.java b/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncClientExchangeHandler.java
index f5e895e..6f2f25d 100644
--- a/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncClientExchangeHandler.java
+++ b/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncClientExchangeHandler.java
@@ -46,7 +46,7 @@ import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.mockito.Matchers;
+import org.mockito.ArgumentMatchers;
import org.mockito.Mockito;
public class TestBasicAsyncClientExchangeHandler {
@@ -343,7 +343,7 @@ public class TestBasicAsyncClientExchangeHandler {
@Test
public void testInputTerminated() throws Exception {
this.exchangeHandler.inputTerminated();
- Mockito.verify(this.responseConsumer).failed(Matchers.<ConnectionClosedException>any());
+ Mockito.verify(this.responseConsumer).failed(ArgumentMatchers.<ConnectionClosedException>any());
try {
this.exchangeHandler.getFuture().get();
Assert.fail("ExecutionException expected");
diff --git a/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncRequestHandler.java b/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncRequestHandler.java
index 3b44478..8596292 100644
--- a/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncRequestHandler.java
+++ b/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncRequestHandler.java
@@ -38,7 +38,7 @@ import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.mockito.Matchers;
+import org.mockito.ArgumentMatchers;
import org.mockito.Mockito;
public class TestBasicAsyncRequestHandler {
@@ -90,7 +90,7 @@ public class TestBasicAsyncRequestHandler {
this.asyncRequestHandler.handle(this.request, this.httpexchange, this.context);
Mockito.verify(this.requestHandler).handle(
- Matchers.eq(this.request), Matchers.eq(this.response), Matchers.eq(this.context));
+ ArgumentMatchers.eq(this.request), ArgumentMatchers.eq(this.response), ArgumentMatchers.eq(this.context));
Mockito.verify(this.httpexchange).submitResponse();
}
diff --git a/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequestExecutor.java b/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequestExecutor.java
index 3568fd0..fffac8a 100644
--- a/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequestExecutor.java
+++ b/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequestExecutor.java
@@ -52,7 +52,7 @@ import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.mockito.Matchers;
+import org.mockito.ArgumentMatchers;
import org.mockito.Mockito;
public class TestHttpAsyncRequestExecutor {
@@ -131,7 +131,7 @@ public class TestHttpAsyncRequestExecutor {
this.protocolHandler.closed(this.conn);
- Mockito.verify(this.exchangeHandler).failed(Matchers.any(ConnectionClosedException.class));
+ Mockito.verify(this.exchangeHandler).failed(ArgumentMatchers.any(ConnectionClosedException.class));
}
@Test
@@ -195,7 +195,7 @@ public class TestHttpAsyncRequestExecutor {
Assert.assertNull(state.getRequest());
Mockito.verify(this.conn, Mockito.times(1)).suspendOutput();
- Mockito.verify(this.conn, Mockito.never()).submitRequest(Matchers.<HttpRequest>any());
+ Mockito.verify(this.conn, Mockito.never()).submitRequest(ArgumentMatchers.<HttpRequest>any());
}
@Test
@@ -612,7 +612,7 @@ public class TestHttpAsyncRequestExecutor {
Assert.assertFalse(state.isValid());
Mockito.verify(this.conn).close();
- Mockito.verify(this.exchangeHandler).failed(Matchers.any(ConnectionClosedException.class));
+ Mockito.verify(this.exchangeHandler).failed(ArgumentMatchers.any(ConnectionClosedException.class));
}
@Test
@@ -671,10 +671,10 @@ public class TestHttpAsyncRequestExecutor {
Assert.assertEquals(MessageState.BODY_STREAM, state.getRequestState());
Assert.assertFalse(state.isValid());
- Mockito.verify(this.exchangeHandler).failed(Matchers.any(SocketTimeoutException.class));
+ Mockito.verify(this.exchangeHandler).failed(ArgumentMatchers.any(SocketTimeoutException.class));
Mockito.verify(this.exchangeHandler).close();
Mockito.verify(this.conn).close();
- Mockito.verify(this.conn, Mockito.never()).setSocketTimeout(Matchers.anyInt());
+ Mockito.verify(this.conn, Mockito.never()).setSocketTimeout(ArgumentMatchers.anyInt());
}
@Test
@@ -689,7 +689,7 @@ public class TestHttpAsyncRequestExecutor {
Assert.assertEquals(MessageState.BODY_STREAM, state.getRequestState());
Assert.assertFalse(state.isValid());
- Mockito.verify(this.exchangeHandler).failed(Matchers.any(SocketTimeoutException.class));
+ Mockito.verify(this.exchangeHandler).failed(ArgumentMatchers.any(SocketTimeoutException.class));
Mockito.verify(this.exchangeHandler).close();
Mockito.verify(this.conn).close();
Mockito.verify(this.conn).setSocketTimeout(250);
@@ -707,7 +707,7 @@ public class TestHttpAsyncRequestExecutor {
Assert.assertEquals(MessageState.BODY_STREAM, state.getRequestState());
Assert.assertFalse(state.isValid());
- Mockito.verify(this.exchangeHandler).failed(Matchers.any(SocketTimeoutException.class));
+ Mockito.verify(this.exchangeHandler).failed(ArgumentMatchers.any(SocketTimeoutException.class));
Mockito.verify(this.exchangeHandler).close();
Mockito.verify(this.conn).shutdown();
}
diff --git a/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequester.java b/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequester.java
index ff9f753..6b203b1 100644
--- a/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequester.java
+++ b/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequester.java
@@ -47,7 +47,7 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
-import org.mockito.Matchers;
+import org.mockito.ArgumentMatchers;
import org.mockito.Mockito;
public class TestHttpAsyncRequester {
@@ -174,8 +174,8 @@ public class TestHttpAsyncRequester {
this.responseConsumer,
this.conn, this.exchangeContext, null);
Assert.assertNotNull(future);
- Mockito.verify(this.requestProducer).failed(Matchers.any(ConnectionClosedException.class));
- Mockito.verify(this.responseConsumer).failed(Matchers.any(ConnectionClosedException.class));
+ Mockito.verify(this.requestProducer).failed(ArgumentMatchers.any(ConnectionClosedException.class));
+ Mockito.verify(this.responseConsumer).failed(ArgumentMatchers.any(ConnectionClosedException.class));
Mockito.verify(this.requestProducer, Mockito.atLeastOnce()).close();
Mockito.verify(this.responseConsumer, Mockito.atLeastOnce()).close();
Assert.assertTrue(future.isDone());
@@ -203,7 +203,7 @@ public class TestHttpAsyncRequester {
Assert.assertNotNull(future);
final ArgumentCaptor<FutureCallback> argCaptor = ArgumentCaptor.forClass(FutureCallback.class);
Mockito.verify(this.connPool).lease(
- Matchers.eq(host), Matchers.isNull(), argCaptor.capture());
+ ArgumentMatchers.eq(host), ArgumentMatchers.isNull(), argCaptor.capture());
final ConnRequestCallback connRequestCallback = (ConnRequestCallback) argCaptor.getValue();
final Exception oppsie = new Exception();
@@ -227,7 +227,7 @@ public class TestHttpAsyncRequester {
Assert.assertNotNull(future);
final ArgumentCaptor<FutureCallback> argCaptor = ArgumentCaptor.forClass(FutureCallback.class);
Mockito.verify(this.connPool).lease(
- Matchers.eq(host), Matchers.isNull(), argCaptor.capture());
+ ArgumentMatchers.eq(host), ArgumentMatchers.isNull(), argCaptor.capture());
final ConnRequestCallback connRequestCallback = (ConnRequestCallback) argCaptor.getValue();
connRequestCallback.cancelled();
@@ -250,7 +250,7 @@ public class TestHttpAsyncRequester {
Assert.assertNotNull(future);
final ArgumentCaptor<FutureCallback> argCaptor = ArgumentCaptor.forClass(FutureCallback.class);
Mockito.verify(this.connPool).lease(
- Matchers.eq(host), Matchers.isNull(), argCaptor.capture());
+ ArgumentMatchers.eq(host), ArgumentMatchers.isNull(), argCaptor.capture());
final ConnRequestCallback connRequestCallback = (ConnRequestCallback) argCaptor.getValue();
future.cancel(true);
@@ -275,7 +275,7 @@ public class TestHttpAsyncRequester {
Assert.assertNotNull(future);
final ArgumentCaptor<FutureCallback> argCaptor = ArgumentCaptor.forClass(FutureCallback.class);
Mockito.verify(this.connPool).lease(
- Matchers.eq(host), Matchers.isNull(), argCaptor.capture());
+ ArgumentMatchers.eq(host), ArgumentMatchers.isNull(), argCaptor.capture());
final ConnRequestCallback connRequestCallback = (ConnRequestCallback) argCaptor.getValue();
final BasicNIOPoolEntry entry = new BasicNIOPoolEntry("id", host, this.conn);
@@ -308,7 +308,7 @@ public class TestHttpAsyncRequester {
Assert.assertNotNull(future);
final ArgumentCaptor<FutureCallback> argCaptor = ArgumentCaptor.forClass(FutureCallback.class);
Mockito.verify(this.connPool).lease(
- Matchers.eq(host), Matchers.isNull(), argCaptor.capture());
+ ArgumentMatchers.eq(host), ArgumentMatchers.isNull(), argCaptor.capture());
final ConnRequestCallback connRequestCallback = (ConnRequestCallback) argCaptor.getValue();
final BasicNIOPoolEntry entry = new BasicNIOPoolEntry("id", host, this.conn);
@@ -341,7 +341,7 @@ public class TestHttpAsyncRequester {
Assert.assertNotNull(future);
final ArgumentCaptor<FutureCallback> argCaptor = ArgumentCaptor.forClass(FutureCallback.class);
Mockito.verify(this.connPool).lease(
- Matchers.eq(host), Matchers.isNull(), argCaptor.capture());
+ ArgumentMatchers.eq(host), ArgumentMatchers.isNull(), argCaptor.capture());
final ConnRequestCallback connRequestCallback = (ConnRequestCallback) argCaptor.getValue();
final BasicNIOPoolEntry entry = new BasicNIOPoolEntry("id", host, this.conn);
diff --git a/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncService.java b/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncService.java
index cab68e7..ca3618b 100644
--- a/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncService.java
+++ b/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncService.java
@@ -65,7 +65,7 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.ArgumentMatcher;
-import org.mockito.Matchers;
+import org.mockito.ArgumentMatchers;
import org.mockito.Mockito;
public class TestHttpAsyncService {
@@ -214,7 +214,7 @@ public class TestHttpAsyncService {
Mockito.when(this.conn.getHttpRequest()).thenReturn(request);
Mockito.doThrow(new RuntimeException()).when(this.httpProcessor).process(
- Matchers.any(HttpResponse.class), Matchers.any(HttpContext.class));
+ ArgumentMatchers.any(HttpResponse.class), ArgumentMatchers.any(HttpContext.class));
final HttpException httpex = new HttpException();
try {
this.protocolHandler.exception(this.conn, httpex);
@@ -248,7 +248,7 @@ public class TestHttpAsyncService {
Mockito.when(this.conn.getHttpRequest()).thenReturn(request);
Mockito.doThrow(new IOException()).when(this.httpProcessor).process(
- Matchers.any(HttpResponse.class), Matchers.any(HttpContext.class));
+ ArgumentMatchers.any(HttpResponse.class), ArgumentMatchers.any(HttpContext.class));
final HttpException httpex = new HttpException();
this.protocolHandler.exception(this.conn, httpex);
@@ -298,7 +298,7 @@ public class TestHttpAsyncService {
final HttpRequest request = new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1);
Mockito.when(this.conn.getHttpRequest()).thenReturn(request);
Mockito.when(this.requestHandler.processRequest(
- Matchers.eq(request), Matchers.any(HttpContext.class))).thenReturn(this.requestConsumer);
+ ArgumentMatchers.eq(request), ArgumentMatchers.any(HttpContext.class))).thenReturn(this.requestConsumer);
Mockito.when(this.requestConsumer.getException()).thenReturn(null);
final Object data = new Object();
Mockito.when(this.requestConsumer.getResult()).thenReturn(data);
@@ -312,7 +312,7 @@ public class TestHttpAsyncService {
Assert.assertNull(incoming);
final ArgumentCaptor<HttpContext> argumentCaptor = ArgumentCaptor.forClass(HttpContext.class);
- Mockito.verify(this.httpProcessor).process(Matchers.eq(request), argumentCaptor.capture());
+ Mockito.verify(this.httpProcessor).process(ArgumentMatchers.eq(request), argumentCaptor.capture());
final HttpContext exchangeContext = argumentCaptor.getValue();
Assert.assertNotNull(exchangeContext);
@@ -341,7 +341,7 @@ public class TestHttpAsyncService {
final HttpRequest request = new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1);
Mockito.when(this.conn.getHttpRequest()).thenReturn(request);
Mockito.when(this.requestHandler.processRequest(
- Matchers.eq(request), Matchers.any(HttpContext.class))).thenReturn(this.requestConsumer);
+ ArgumentMatchers.eq(request), ArgumentMatchers.any(HttpContext.class))).thenReturn(this.requestConsumer);
Mockito.when(this.requestConsumer.getException()).thenReturn(null);
final Object data = new Object();
Mockito.when(this.requestConsumer.getResult()).thenReturn(data);
@@ -355,11 +355,11 @@ public class TestHttpAsyncService {
Assert.assertNull(incoming);
Mockito.verify(this.requestConsumer).requestReceived(request);
- Mockito.verify(this.requestConsumer).requestCompleted(Matchers.<HttpContext>any());
+ Mockito.verify(this.requestConsumer).requestCompleted(ArgumentMatchers.<HttpContext>any());
Mockito.verify(this.requestHandler, Mockito.never()).handle(
- Matchers.any(),
- Matchers.any(HttpAsyncExchange.class),
- Matchers.any(HttpContext.class));
+ ArgumentMatchers.any(),
+ ArgumentMatchers.any(HttpAsyncExchange.class),
+ ArgumentMatchers.any(HttpContext.class));
Assert.assertFalse(state.getPipeline().isEmpty());
final PipelineEntry entry = state.getPipeline().remove();
@@ -386,7 +386,7 @@ public class TestHttpAsyncService {
final HttpRequest request = new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1);
Mockito.when(this.conn.getHttpRequest()).thenReturn(request);
Mockito.when(this.requestHandler.processRequest(
- Matchers.eq(request), Matchers.any(HttpContext.class))).thenReturn(this.requestConsumer);
+ ArgumentMatchers.eq(request), ArgumentMatchers.any(HttpContext.class))).thenReturn(this.requestConsumer);
Mockito.when(this.requestConsumer.getException()).thenReturn(null);
final Object data = new Object();
Mockito.when(this.requestConsumer.getResult()).thenReturn(data);
@@ -400,11 +400,11 @@ public class TestHttpAsyncService {
Assert.assertNull(incoming);
Mockito.verify(this.requestConsumer).requestReceived(request);
- Mockito.verify(this.requestConsumer).requestCompleted(Matchers.<HttpContext>any());
+ Mockito.verify(this.requestConsumer).requestCompleted(ArgumentMatchers.<HttpContext>any());
Mockito.verify(this.requestHandler, Mockito.never()).handle(
- Matchers.any(),
- Matchers.any(HttpAsyncExchange.class),
- Matchers.any(HttpContext.class));
+ ArgumentMatchers.any(),
+ ArgumentMatchers.any(HttpAsyncExchange.class),
+ ArgumentMatchers.any(HttpContext.class));
Assert.assertFalse(state.getPipeline().isEmpty());
final PipelineEntry entry1 = state.getPipeline().remove();
@@ -424,7 +424,7 @@ public class TestHttpAsyncService {
request.setEntity(new NStringEntity("stuff"));
Mockito.when(this.conn.getHttpRequest()).thenReturn(request);
Mockito.when(this.requestHandler.processRequest(
- Matchers.eq(request), Matchers.any(HttpContext.class))).thenReturn(this.requestConsumer);
+ ArgumentMatchers.eq(request), ArgumentMatchers.any(HttpContext.class))).thenReturn(this.requestConsumer);
this.protocolHandler.requestReceived(this.conn);
@@ -446,7 +446,7 @@ public class TestHttpAsyncService {
HttpVersion.HTTP_1_1);
Mockito.when(this.conn.getHttpRequest()).thenReturn(request);
Mockito.when(this.requestHandler.processRequest(
- Matchers.eq(request), Matchers.any(HttpContext.class))).thenReturn(this.requestConsumer);
+ ArgumentMatchers.eq(request), ArgumentMatchers.any(HttpContext.class))).thenReturn(this.requestConsumer);
this.protocolHandler.requestReceived(this.conn);
@@ -480,7 +480,7 @@ public class TestHttpAsyncService {
request.addHeader(HTTP.EXPECT_DIRECTIVE, HTTP.EXPECT_CONTINUE);
Mockito.when(this.conn.getHttpRequest()).thenReturn(request);
Mockito.when(this.requestHandler.processRequest(
- Matchers.eq(request), Matchers.any(HttpContext.class))).thenReturn(this.requestConsumer);
+ ArgumentMatchers.eq(request), ArgumentMatchers.any(HttpContext.class))).thenReturn(this.requestConsumer);
this.protocolHandler.requestReceived(this.conn);
@@ -502,7 +502,7 @@ public class TestHttpAsyncService {
Mockito.verify(this.httpProcessor).process(request, exchangeContext);
Mockito.verify(this.requestConsumer).requestReceived(request);
Mockito.verify(this.conn, Mockito.never()).suspendInput();
- Mockito.verify(this.conn).submitResponse(Matchers.argThat(new ArgumentMatcher<HttpResponse>() {
+ Mockito.verify(this.conn).submitResponse(ArgumentMatchers.argThat(new ArgumentMatcher<HttpResponse>() {
@Override
public boolean matches(final HttpResponse argument) {
@@ -528,7 +528,7 @@ public class TestHttpAsyncService {
request.addHeader(HTTP.EXPECT_DIRECTIVE, HTTP.EXPECT_CONTINUE);
Mockito.when(this.conn.getHttpRequest()).thenReturn(request);
Mockito.when(this.requestHandler.processRequest(
- Matchers.eq(request), Matchers.any(HttpContext.class))).thenReturn(this.requestConsumer);
+ ArgumentMatchers.eq(request), ArgumentMatchers.any(HttpContext.class))).thenReturn(this.requestConsumer);
this.protocolHandler.requestReceived(this.conn);
@@ -551,8 +551,8 @@ public class TestHttpAsyncService {
Mockito.verify(this.requestConsumer).requestReceived(request);
Mockito.verify(this.conn).suspendInput();
Mockito.verify(expectationVerifier).verify(
- Matchers.any(HttpAsyncExchange.class),
- Matchers.eq(exchangeContext));
+ ArgumentMatchers.any(HttpAsyncExchange.class),
+ ArgumentMatchers.eq(exchangeContext));
}
@Test
@@ -612,7 +612,7 @@ public class TestHttpAsyncService {
Mockito.when(this.conn.getHttpRequest()).thenReturn(request);
Mockito.when(this.requestHandler.processRequest(
- Matchers.eq(request), Matchers.any(HttpContext.class))).thenReturn(this.requestConsumer);
+ ArgumentMatchers.eq(request), ArgumentMatchers.any(HttpContext.class))).thenReturn(this.requestConsumer);
this.protocolHandler.requestReceived(this.conn);
@@ -644,7 +644,7 @@ public class TestHttpAsyncService {
Mockito.when(this.conn.getHttpRequest()).thenReturn(request);
Mockito.when(this.requestHandler.processRequest(
- Matchers.eq(request), Matchers.any(HttpContext.class))).thenReturn(this.requestConsumer);
+ ArgumentMatchers.eq(request), ArgumentMatchers.any(HttpContext.class))).thenReturn(this.requestConsumer);
this.protocolHandler.requestReceived(this.conn);
@@ -672,7 +672,7 @@ public class TestHttpAsyncService {
Mockito.when(this.conn.getContext()).thenReturn(this.connContext);
Mockito.when(this.conn.getHttpRequest()).thenReturn(request);
Mockito.when(this.requestHandler.processRequest(
- Matchers.eq(request), Matchers.any(HttpContext.class))).thenReturn(this.requestConsumer);
+ ArgumentMatchers.eq(request), ArgumentMatchers.any(HttpContext.class))).thenReturn(this.requestConsumer);
Mockito.when(((SessionBufferStatus) this.conn).hasBufferedInput()).thenReturn(Boolean.TRUE);
this.protocolHandler.requestReceived(this.conn);
@@ -1019,7 +1019,7 @@ public class TestHttpAsyncService {
Assert.assertEquals(MessageState.READY, state.getResponseState());
Mockito.verify(this.conn).requestInput();
- Mockito.verify(this.conn).submitResponse(Matchers.argThat(new ArgumentMatcher<HttpResponse>() {
+ Mockito.verify(this.conn).submitResponse(ArgumentMatchers.argThat(new ArgumentMatcher<HttpResponse>() {
@Override
public boolean matches(final HttpResponse argument) {
@@ -1098,8 +1098,8 @@ public class TestHttpAsyncService {
Assert.assertNull(state.getOutgoing());
final ArgumentCaptor<HttpAsyncExchange> argCaptor = ArgumentCaptor.forClass(HttpAsyncExchange.class);
- Mockito.verify(this.requestHandler).handle(Matchers.same(request),
- argCaptor.capture(), Matchers.same(exchangeContext));
+ Mockito.verify(this.requestHandler).handle(ArgumentMatchers.same(request),
+ argCaptor.capture(), ArgumentMatchers.same(exchangeContext));
final HttpAsyncExchange exchange = argCaptor.getValue();
Assert.assertNotNull(exchange);
@@ -1133,9 +1133,9 @@ public class TestHttpAsyncService {
Assert.assertNotNull(response);
Assert.assertEquals(500, response.getStatusLine().getStatusCode());
- Mockito.verify(this.requestHandler, Mockito.never()).handle(Matchers.<HttpRequest>any(),
- Matchers.<HttpAsyncExchange>any(), Matchers.<HttpContext>any());
- Mockito.verify(this.conn).submitResponse(Matchers.same(response));
+ Mockito.verify(this.requestHandler, Mockito.never()).handle(ArgumentMatchers.<HttpRequest>any(),
+ ArgumentMatchers.<HttpAsyncExchange>any(), ArgumentMatchers.<HttpContext>any());
+ Mockito.verify(this.conn).submitResponse(ArgumentMatchers.same(response));
}
@Test(expected=HttpException.class)
@@ -1314,7 +1314,7 @@ public class TestHttpAsyncService {
this.protocolHandler.endOfInput(this.conn);
- Mockito.verify(this.conn, Mockito.never()).setSocketTimeout(Matchers.anyInt());
+ Mockito.verify(this.conn, Mockito.never()).setSocketTimeout(ArgumentMatchers.anyInt());
Mockito.verify(this.conn).close();
}
@@ -1344,7 +1344,7 @@ public class TestHttpAsyncService {
this.protocolHandler.timeout(this.conn);
Mockito.verify(this.conn, Mockito.atLeastOnce()).close();
- Mockito.verify(this.conn, Mockito.never()).setSocketTimeout(Matchers.anyInt());
+ Mockito.verify(this.conn, Mockito.never()).setSocketTimeout(ArgumentMatchers.anyInt());
}
@Test
@@ -1383,9 +1383,9 @@ public class TestHttpAsyncService {
this.protocolHandler.timeout(this.conn);
Mockito.verify(this.conn).shutdown();
- Mockito.verify(this.requestConsumer).failed(Matchers.any(SocketTimeoutException.class));
+ Mockito.verify(this.requestConsumer).failed(ArgumentMatchers.any(SocketTimeoutException.class));
Mockito.verify(this.requestConsumer).close();
- Mockito.verify(this.responseProducer).failed(Matchers.any(SocketTimeoutException.class));
+ Mockito.verify(this.responseProducer).failed(ArgumentMatchers.any(SocketTimeoutException.class));
Mockito.verify(this.responseProducer).close();
}
diff --git a/httpcore/src/test/java/org/apache/http/impl/TestBHttpConnectionBase.java b/httpcore/src/test/java/org/apache/http/impl/TestBHttpConnectionBase.java
index 0277515..36d7169 100644
--- a/httpcore/src/test/java/org/apache/http/impl/TestBHttpConnectionBase.java
+++ b/httpcore/src/test/java/org/apache/http/impl/TestBHttpConnectionBase.java
@@ -52,7 +52,7 @@ import org.apache.http.message.BasicHttpResponse;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.mockito.Matchers;
+import org.mockito.ArgumentMatchers;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
@@ -127,13 +127,13 @@ public class TestBHttpConnectionBase {
Assert.assertFalse(conn.isOpen());
Mockito.verify(outStream, Mockito.times(1)).write(
- Matchers.<byte []>any(), Matchers.anyInt(), Matchers.anyInt());
+ ArgumentMatchers.<byte []>any(), ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt());
Mockito.verify(socket, Mockito.times(1)).close();
conn.close();
Mockito.verify(socket, Mockito.times(1)).close();
Mockito.verify(outStream, Mockito.times(1)).write(
- Matchers.<byte []>any(), Matchers.anyInt(), Matchers.anyInt());
+ ArgumentMatchers.<byte []>any(), ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt());
}
@Test
@@ -154,7 +154,7 @@ public class TestBHttpConnectionBase {
Assert.assertFalse(conn.isOpen());
Mockito.verify(outStream, Mockito.never()).write(
- Matchers.<byte []>any(), Matchers.anyInt(), Matchers.anyInt());
+ ArgumentMatchers.<byte []>any(), ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt());
Mockito.verify(socket, Mockito.never()).shutdownInput();
Mockito.verify(socket, Mockito.never()).shutdownOutput();
Mockito.verify(socket, Mockito.times(1)).close();
@@ -251,7 +251,7 @@ public class TestBHttpConnectionBase {
public void testSetSocketTimeoutException() throws Exception {
conn.bind(socket);
- Mockito.doThrow(new SocketException()).when(socket).setSoTimeout(Matchers.anyInt());
+ Mockito.doThrow(new SocketException()).when(socket).setSoTimeout(ArgumentMatchers.anyInt());
conn.setSocketTimeout(123);
@@ -291,9 +291,9 @@ public class TestBHttpConnectionBase {
Assert.assertTrue(conn.awaitInput(432));
- Mockito.verify(socket, Mockito.never()).setSoTimeout(Matchers.anyInt());
+ Mockito.verify(socket, Mockito.never()).setSoTimeout(ArgumentMatchers.anyInt());
Mockito.verify(inStream, Mockito.times(1)).read(
- Matchers.<byte []>any(), Matchers.anyInt(), Matchers.anyInt());
+ ArgumentMatchers.<byte []>any(), ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt());
}
@Test
@@ -312,14 +312,14 @@ public class TestBHttpConnectionBase {
Mockito.verify(socket, Mockito.times(1)).setSoTimeout(432);
Mockito.verify(socket, Mockito.times(1)).setSoTimeout(345);
Mockito.verify(inStream, Mockito.times(1)).read(
- Matchers.<byte []>any(), Matchers.anyInt(), Matchers.anyInt());
+ ArgumentMatchers.<byte []>any(), ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt());
}
@Test
public void testAwaitInputNoData() throws Exception {
final InputStream inStream = Mockito.mock(InputStream.class);
Mockito.when(socket.getInputStream()).thenReturn(inStream);
- Mockito.when(inStream.read(Matchers.<byte []>any(), Matchers.anyInt(), Matchers.anyInt()))
+ Mockito.when(inStream.read(ArgumentMatchers.<byte []>any(), ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt()))
.thenReturn(-1);
conn.bind(socket);
@@ -353,7 +353,7 @@ public class TestBHttpConnectionBase {
public void testStaleWhenEndOfStream() throws Exception {
final InputStream inStream = Mockito.mock(InputStream.class);
Mockito.when(socket.getInputStream()).thenReturn(inStream);
- Mockito.when(inStream.read(Matchers.<byte []>any(), Matchers.anyInt(), Matchers.anyInt()))
+ Mockito.when(inStream.read(ArgumentMatchers.<byte []>any(), ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt()))
.thenReturn(-1);
conn.bind(socket);
@@ -366,7 +366,7 @@ public class TestBHttpConnectionBase {
public void testNotStaleWhenTimeout() throws Exception {
final InputStream inStream = Mockito.mock(InputStream.class);
Mockito.when(socket.getInputStream()).thenReturn(inStream);
- Mockito.when(inStream.read(Matchers.<byte []>any(), Matchers.anyInt(), Matchers.anyInt()))
+ Mockito.when(inStream.read(ArgumentMatchers.<byte []>any(), ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt()))
.thenThrow(new SocketTimeoutException());
conn.bind(socket);
@@ -379,7 +379,7 @@ public class TestBHttpConnectionBase {
public void testStaleWhenIOError() throws Exception {
final InputStream inStream = Mockito.mock(InputStream.class);
Mockito.when(socket.getInputStream()).thenReturn(inStream);
- Mockito.when(inStream.read(Matchers.<byte []>any(), Matchers.anyInt(), Matchers.anyInt()))
+ Mockito.when(inStream.read(ArgumentMatchers.<byte []>any(), ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt()))
.thenThrow(new SocketException());
conn.bind(socket);
diff --git a/httpcore/src/test/java/org/apache/http/impl/io/TestSessionInOutBuffers.java b/httpcore/src/test/java/org/apache/http/impl/io/TestSessionInOutBuffers.java
index 1e85bcd..fc1a69d 100644
--- a/httpcore/src/test/java/org/apache/http/impl/io/TestSessionInOutBuffers.java
+++ b/httpcore/src/test/java/org/apache/http/impl/io/TestSessionInOutBuffers.java
@@ -42,7 +42,7 @@ import org.apache.http.io.HttpTransportMetrics;
import org.apache.http.util.CharArrayBuffer;
import org.junit.Assert;
import org.junit.Test;
-import org.mockito.Matchers;
+import org.mockito.ArgumentMatchers;
import org.mockito.Mockito;
public class TestSessionInOutBuffers {
@@ -341,8 +341,8 @@ public class TestSessionInOutBuffers {
outbuffer.write(new byte[]{3, 4});
outbuffer.flush();
Mockito.verify(outStream, Mockito.times(1)).write(
- Matchers.<byte[]>any(), Matchers.anyInt(), Matchers.anyInt());
- Mockito.verify(outStream, Mockito.never()).write(Matchers.anyInt());
+ ArgumentMatchers.<byte[]>any(), ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt());
+ Mockito.verify(outStream, Mockito.never()).write(ArgumentMatchers.anyInt());
}
@Test
@@ -355,8 +355,8 @@ public class TestSessionInOutBuffers {
outbuffer.write(new byte[] {1, 2});
outbuffer.write(new byte[]{3, 4});
Mockito.verify(outStream, Mockito.times(2)).write(
- Matchers.<byte []>any(), Matchers.anyInt(), Matchers.anyInt());
- Mockito.verify(outStream, Mockito.times(2)).write(Matchers.anyInt());
+ ArgumentMatchers.<byte []>any(), ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt());
+ Mockito.verify(outStream, Mockito.times(2)).write(ArgumentMatchers.anyInt());
}
@Test
diff --git a/httpcore/src/test/java/org/apache/http/pool/TestConnPool.java b/httpcore/src/test/java/org/apache/http/pool/TestConnPool.java
index 30f8be2..54a7da8 100644
--- a/httpcore/src/test/java/org/apache/http/pool/TestConnPool.java
+++ b/httpcore/src/test/java/org/apache/http/pool/TestConnPool.java
@@ -36,7 +36,7 @@ import java.util.concurrent.TimeoutException;
import org.apache.http.HttpConnection;
import org.junit.Assert;
import org.junit.Test;
-import org.mockito.Matchers;
+import org.mockito.ArgumentMatchers;
import org.mockito.Mockito;
public class TestConnPool {
@@ -133,8 +133,8 @@ public class TestConnPool {
Mockito.when(conn2.isOpen()).thenReturn(true);
final LocalConnFactory connFactory = Mockito.mock(LocalConnFactory.class);
- Mockito.when(connFactory.create(Matchers.eq("somehost"))).thenReturn(conn1);
- Mockito.when(connFactory.create(Matchers.eq("otherhost"))).thenReturn(conn2);
+ Mockito.when(connFactory.create(ArgumentMatchers.eq("somehost"))).thenReturn(conn1);
+ Mockito.when(connFactory.create(ArgumentMatchers.eq("otherhost"))).thenReturn(conn2);
final LocalConnPool pool = new LocalConnPool(connFactory, 2, 10);
final Future<LocalPoolEntry> future1 = pool.lease("somehost", null);
@@ -233,11 +233,11 @@ public class TestConnPool {
final HttpConnection conn1 = Mockito.mock(HttpConnection.class);
Mockito.when(conn1.isOpen()).thenReturn(true);
- Mockito.when(connFactory.create(Matchers.eq("somehost"))).thenReturn(conn1);
+ Mockito.when(connFactory.create(ArgumentMatchers.eq("somehost"))).thenReturn(conn1);
final HttpConnection conn2 = Mockito.mock(HttpConnection.class);
Mockito.when(conn2.isOpen()).thenReturn(true);
- Mockito.when(connFactory.create(Matchers.eq("otherhost"))).thenReturn(conn2);
+ Mockito.when(connFactory.create(ArgumentMatchers.eq("otherhost"))).thenReturn(conn2);
final LocalConnPool pool = new LocalConnPool(connFactory, 2, 10);
pool.setMaxPerRoute("somehost", 2);
@@ -312,7 +312,7 @@ public class TestConnPool {
Assert.assertFalse(t8.isDone());
Assert.assertFalse(t9.isDone());
- Mockito.verify(connFactory, Mockito.times(3)).create(Matchers.any(String.class));
+ Mockito.verify(connFactory, Mockito.times(3)).create(ArgumentMatchers.any(String.class));
pool.release(entry4, true);
pool.release(entry5, false);
@@ -325,7 +325,7 @@ public class TestConnPool {
t9.join();
Assert.assertTrue(future9.isDone());
- Mockito.verify(connFactory, Mockito.times(4)).create(Matchers.any(String.class));
+ Mockito.verify(connFactory, Mockito.times(4)).create(ArgumentMatchers.any(String.class));
}
@Test
@@ -338,13 +338,13 @@ public class TestConnPool {
Mockito.when(conn2.isOpen()).thenReturn(true);
final HttpConnection conn3 = Mockito.mock(HttpConnection.class);
Mockito.when(conn3.isOpen()).thenReturn(true);
- Mockito.when(connFactory.create(Matchers.eq("somehost"))).thenReturn(conn1, conn2, conn3);
+ Mockito.when(connFactory.create(ArgumentMatchers.eq("somehost"))).thenReturn(conn1, conn2, conn3);
final HttpConnection conn4 = Mockito.mock(HttpConnection.class);
Mockito.when(conn4.isOpen()).thenReturn(true);
final HttpConnection conn5 = Mockito.mock(HttpConnection.class);
Mockito.when(conn5.isOpen()).thenReturn(true);
- Mockito.when(connFactory.create(Matchers.eq("otherhost"))).thenReturn(conn4, conn5);
+ Mockito.when(connFactory.create(ArgumentMatchers.eq("otherhost"))).thenReturn(conn4, conn5);
final LocalConnPool pool = new LocalConnPool(connFactory, 2, 10);
pool.setMaxPerRoute("somehost", 2);
@@ -377,8 +377,8 @@ public class TestConnPool {
Assert.assertFalse(t3.isDone());
Assert.assertFalse(t4.isDone());
- Mockito.verify(connFactory, Mockito.times(2)).create(Matchers.eq("somehost"));
- Mockito.verify(connFactory, Mockito.never()).create(Matchers.eq("otherhost"));
+ Mockito.verify(connFactory, Mockito.times(2)).create(ArgumentMatchers.eq("somehost"));
+ Mockito.verify(connFactory, Mockito.never()).create(ArgumentMatchers.eq("otherhost"));
PoolStats totals = pool.getTotalStats();
Assert.assertEquals(0, totals.getAvailable());
@@ -396,8 +396,8 @@ public class TestConnPool {
final LocalPoolEntry entry4 = t4.getEntry();
Assert.assertNotNull(entry4);
- Mockito.verify(connFactory, Mockito.times(2)).create(Matchers.eq("somehost"));
- Mockito.verify(connFactory, Mockito.times(2)).create(Matchers.eq("otherhost"));
+ Mockito.verify(connFactory, Mockito.times(2)).create(ArgumentMatchers.eq("somehost"));
+ Mockito.verify(connFactory, Mockito.times(2)).create(ArgumentMatchers.eq("otherhost"));
totals = pool.getTotalStats();
Assert.assertEquals(0, totals.getAvailable());
@@ -422,8 +422,8 @@ public class TestConnPool {
final LocalPoolEntry entry6 = t6.getEntry();
Assert.assertNotNull(entry6);
- Mockito.verify(connFactory, Mockito.times(3)).create(Matchers.eq("somehost"));
- Mockito.verify(connFactory, Mockito.times(2)).create(Matchers.eq("otherhost"));
+ Mockito.verify(connFactory, Mockito.times(3)).create(ArgumentMatchers.eq("somehost"));
+ Mockito.verify(connFactory, Mockito.times(2)).create(ArgumentMatchers.eq("otherhost"));
totals = pool.getTotalStats();
Assert.assertEquals(0, totals.getAvailable());
@@ -447,7 +447,7 @@ public class TestConnPool {
Mockito.when(conn2.isOpen()).thenReturn(true);
final HttpConnection conn3 = Mockito.mock(HttpConnection.class);
Mockito.when(conn3.isOpen()).thenReturn(true);
- Mockito.when(connFactory.create(Matchers.eq("somehost"))).thenReturn(conn1, conn2, conn3);
+ Mockito.when(connFactory.create(ArgumentMatchers.eq("somehost"))).thenReturn(conn1, conn2, conn3);
final LocalConnPool pool = new LocalConnPool(connFactory, 2, 10);
pool.setMaxPerRoute("somehost", 2);
@@ -481,7 +481,7 @@ public class TestConnPool {
entry2.setState("some-stuff");
pool.release(entry2, true);
- Mockito.verify(connFactory, Mockito.times(2)).create(Matchers.eq("somehost"));
+ Mockito.verify(connFactory, Mockito.times(2)).create(ArgumentMatchers.eq("somehost"));
final Future<LocalPoolEntry> future3 = pool.lease("somehost", "some-other-stuff");
final GetPoolEntryThread t3 = new GetPoolEntryThread(future3);
@@ -492,7 +492,7 @@ public class TestConnPool {
final LocalPoolEntry entry3 = t3.getEntry();
Assert.assertNotNull(entry3);
- Mockito.verify(connFactory, Mockito.times(3)).create(Matchers.eq("somehost"));
+ Mockito.verify(connFactory, Mockito.times(3)).create(ArgumentMatchers.eq("somehost"));
Mockito.verify(conn1).close();
Mockito.verify(conn2, Mockito.never()).close();
@@ -509,7 +509,7 @@ public class TestConnPool {
final HttpConnection conn1 = Mockito.mock(HttpConnection.class);
Mockito.when(conn1.isOpen()).thenReturn(true);
- Mockito.when(connFactory.create(Matchers.eq("somehost"))).thenReturn(conn1);
+ Mockito.when(connFactory.create(ArgumentMatchers.eq("somehost"))).thenReturn(conn1);
final LocalConnPool pool = new LocalConnPool(connFactory, 2, 2);
@@ -517,7 +517,7 @@ public class TestConnPool {
final LocalPoolEntry entry1 = future1.get(1, TimeUnit.SECONDS);
Assert.assertNotNull(entry1);
- Mockito.verify(connFactory, Mockito.times(1)).create(Matchers.eq("somehost"));
+ Mockito.verify(connFactory, Mockito.times(1)).create(ArgumentMatchers.eq("somehost"));
entry1.updateExpiry(1, TimeUnit.MILLISECONDS);
pool.release(entry1, true);
@@ -528,7 +528,7 @@ public class TestConnPool {
final LocalPoolEntry entry2 = future2.get(1, TimeUnit.SECONDS);
Assert.assertNotNull(entry2);
- Mockito.verify(connFactory, Mockito.times(2)).create(Matchers.eq("somehost"));
+ Mockito.verify(connFactory, Mockito.times(2)).create(ArgumentMatchers.eq("somehost"));
final PoolStats totals = pool.getTotalStats();
Assert.assertEquals(0, totals.getAvailable());
@@ -548,7 +548,7 @@ public class TestConnPool {
final HttpConnection conn2 = Mockito.mock(HttpConnection.class);
Mockito.when(conn2.isOpen()).thenReturn(Boolean.TRUE);
- Mockito.when(connFactory.create(Matchers.eq("somehost"))).thenReturn(conn1, conn2);
+ Mockito.when(connFactory.create(ArgumentMatchers.eq("somehost"))).thenReturn(conn1, conn2);
final LocalConnPool pool = new LocalConnPool(connFactory, 2, 2);
@@ -586,7 +586,7 @@ public class TestConnPool {
final HttpConnection conn1 = Mockito.mock(HttpConnection.class);
Mockito.when(conn1.isOpen()).thenReturn(true);
- Mockito.when(connFactory.create(Matchers.eq("somehost"))).thenReturn(conn1);
+ Mockito.when(connFactory.create(ArgumentMatchers.eq("somehost"))).thenReturn(conn1);
final LocalConnPool pool = new LocalConnPool(connFactory, 1, 1);
@@ -633,7 +633,7 @@ public class TestConnPool {
final HttpConnection conn1 = Mockito.mock(HttpConnection.class);
Mockito.when(conn1.isOpen()).thenReturn(true);
- Mockito.when(connFactory.create(Matchers.eq("somehost"))).thenReturn(conn1);
+ Mockito.when(connFactory.create(ArgumentMatchers.eq("somehost"))).thenReturn(conn1);
final LocalConnPool pool = new LocalConnPool(connFactory, 1, 1);
@@ -672,7 +672,7 @@ public class TestConnPool {
final HttpConnection conn2 = Mockito.mock(HttpConnection.class);
Mockito.when(conn2.isOpen()).thenReturn(true);
- Mockito.when(connFactory.create(Matchers.eq("somehost"))).thenReturn(conn1, conn2);
+ Mockito.when(connFactory.create(ArgumentMatchers.eq("somehost"))).thenReturn(conn1, conn2);
final LocalConnPool pool = new LocalConnPool(connFactory, 2, 2);
@@ -768,10 +768,10 @@ public class TestConnPool {
final HttpConnection conn1 = Mockito.mock(HttpConnection.class);
Mockito.when(conn1.isOpen()).thenReturn(true);
- Mockito.when(connFactory.create(Matchers.eq("somehost"))).thenReturn(conn1);
+ Mockito.when(connFactory.create(ArgumentMatchers.eq("somehost"))).thenReturn(conn1);
final HttpConnection conn2 = Mockito.mock(HttpConnection.class);
Mockito.when(conn2.isOpen()).thenReturn(true);
- Mockito.when(connFactory.create(Matchers.eq("otherhost"))).thenReturn(conn2);
+ Mockito.when(connFactory.create(ArgumentMatchers.eq("otherhost"))).thenReturn(conn2);
final LocalConnPool pool = new LocalConnPool(connFactory, 2, 2);
final Future<LocalPoolEntry> future1 = pool.lease("somehost", null);
@@ -811,7 +811,7 @@ public class TestConnPool {
Mockito.when(conn.isStale()).thenReturn(false);
final LocalConnFactory connFactory = Mockito.mock(LocalConnFactory.class);
- Mockito.when(connFactory.create(Matchers.eq("somehost"))).thenReturn(conn);
+ Mockito.when(connFactory.create(ArgumentMatchers.eq("somehost"))).thenReturn(conn);
final LocalConnPool pool = new LocalConnPool(connFactory, 2, 10);
pool.setValidateAfterInactivity(100);
@@ -839,7 +839,7 @@ public class TestConnPool {
Mockito.when(conn.isStale()).thenReturn(false);
final LocalConnFactory connFactory = Mockito.mock(LocalConnFactory.class);
- Mockito.when(connFactory.create(Matchers.eq("somehost"))).thenReturn(conn);
+ Mockito.when(connFactory.create(ArgumentMatchers.eq("somehost"))).thenReturn(conn);
final LocalConnPool pool = new LocalConnPool(connFactory, 2, 10);
pool.setValidateAfterInactivity(5);
diff --git a/httpcore/src/test/java/org/apache/http/protocol/TestHttpRequestExecutor.java b/httpcore/src/test/java/org/apache/http/protocol/TestHttpRequestExecutor.java
index 0b078c3..418ced5 100644
--- a/httpcore/src/test/java/org/apache/http/protocol/TestHttpRequestExecutor.java
+++ b/httpcore/src/test/java/org/apache/http/protocol/TestHttpRequestExecutor.java
@@ -41,7 +41,7 @@ import org.apache.http.message.BasicHttpRequest;
import org.apache.http.message.BasicHttpResponse;
import org.junit.Assert;
import org.junit.Test;
-import org.mockito.Matchers;
+import org.mockito.ArgumentMatchers;
import org.mockito.Mockito;
public class TestHttpRequestExecutor {
@@ -308,7 +308,7 @@ public class TestHttpRequestExecutor {
Mockito.when(conn.receiveResponseHeader()).thenReturn(
new BasicHttpResponse(HttpVersion.HTTP_1_1, 100, "Continue"),
new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK"));
- Mockito.when(conn.isResponseAvailable(Matchers.anyInt())).thenReturn(Boolean.TRUE);
+ Mockito.when(conn.isResponseAvailable(ArgumentMatchers.anyInt())).thenReturn(Boolean.TRUE);
final HttpResponse response = executor.execute(request, conn, context);
Mockito.verify(conn).sendRequestHeader(request);
@@ -341,7 +341,7 @@ public class TestHttpRequestExecutor {
Mockito.when(conn.receiveResponseHeader()).thenReturn(
new BasicHttpResponse(HttpVersion.HTTP_1_1, 402, "OK"));
- Mockito.when(conn.isResponseAvailable(Matchers.anyInt())).thenReturn(Boolean.TRUE);
+ Mockito.when(conn.isResponseAvailable(ArgumentMatchers.anyInt())).thenReturn(Boolean.TRUE);
final HttpResponse response = executor.execute(request, conn, context);
Mockito.verify(conn).sendRequestHeader(request);
@@ -372,7 +372,7 @@ public class TestHttpRequestExecutor {
Mockito.when(conn.receiveResponseHeader()).thenReturn(
new BasicHttpResponse(HttpVersion.HTTP_1_1, 101, "OK"));
- Mockito.when(conn.isResponseAvailable(Matchers.anyInt())).thenReturn(Boolean.TRUE);
+ Mockito.when(conn.isResponseAvailable(ArgumentMatchers.anyInt())).thenReturn(Boolean.TRUE);
try {
executor.execute(request, conn, context);
@@ -400,7 +400,7 @@ public class TestHttpRequestExecutor {
Mockito.when(conn.receiveResponseHeader()).thenReturn(
new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK"));
- Mockito.when(conn.isResponseAvailable(Matchers.anyInt())).thenReturn(Boolean.FALSE);
+ Mockito.when(conn.isResponseAvailable(ArgumentMatchers.anyInt())).thenReturn(Boolean.FALSE);
final HttpResponse response = executor.execute(request, conn, context);
Mockito.verify(conn).sendRequestHeader(request);
diff --git a/httpcore/src/test/java/org/apache/http/protocol/TestHttpService.java b/httpcore/src/test/java/org/apache/http/protocol/TestHttpService.java
index 3bcd4bb..ae11304 100644
--- a/httpcore/src/test/java/org/apache/http/protocol/TestHttpService.java
+++ b/httpcore/src/test/java/org/apache/http/protocol/TestHttpService.java
@@ -47,7 +47,7 @@ import org.apache.http.message.BasicHttpRequest;
import org.apache.http.message.BasicHttpResponse;
import org.junit.Assert;
import org.junit.Test;
-import org.mockito.Matchers;
+import org.mockito.ArgumentMatchers;
import org.mockito.Mockito;
public class TestHttpService {
@@ -543,7 +543,7 @@ public class TestHttpService {
Mockito.verify(requestHandler).handle(request, response, context);
Mockito.verify(conn).sendResponseHeader(response);
- Mockito.verify(conn, Mockito.never()).sendResponseEntity(Matchers.<HttpResponse>any());
+ Mockito.verify(conn, Mockito.never()).sendResponseEntity(ArgumentMatchers.<HttpResponse>any());
Mockito.verify(conn).flush();
Mockito.verify(conn, Mockito.never()).close();
}
@@ -580,7 +580,7 @@ public class TestHttpService {
Mockito.verify(requestHandler).handle(request, response, context);
Mockito.verify(conn).sendResponseHeader(response);
- Mockito.verify(conn, Mockito.never()).sendResponseEntity(Matchers.<HttpResponse>any());
+ Mockito.verify(conn, Mockito.never()).sendResponseEntity(ArgumentMatchers.<HttpResponse>any());
Mockito.verify(conn).flush();
Mockito.verify(conn, Mockito.never()).close();
}
--
2.43.0