You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by gg...@apache.org on 2017/09/02 20:05:12 UTC
[1/2] httpcomponents-core git commit: Access static methods with the
class that defines them, not a subclass.
Repository: httpcomponents-core
Updated Branches:
refs/heads/4.4.x 442d26066 -> 4e99c599b
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/4e99c599/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncService.java
----------------------------------------------------------------------
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 da91c87..235915b 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
@@ -46,7 +46,7 @@ import org.apache.http.message.BasicHttpRequest;
import org.apache.http.message.BasicHttpResponse;
import org.apache.http.nio.ContentDecoder;
import org.apache.http.nio.ContentEncoder;
-import org.apache.http.nio.NHttpClientConnection;
+import org.apache.http.nio.NHttpConnection;
import org.apache.http.nio.NHttpServerConnection;
import org.apache.http.nio.entity.NStringEntity;
import org.apache.http.nio.protocol.HttpAsyncService.Incoming;
@@ -65,6 +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.Mockito;
public class TestHttpAsyncService {
@@ -212,7 +213,7 @@ public class TestHttpAsyncService {
this.connContext.setAttribute(HttpAsyncService.HTTP_EXCHANGE_STATE, state);
Mockito.doThrow(new RuntimeException()).when(this.httpProcessor).process(
- Mockito.any(HttpResponse.class), Mockito.any(HttpContext.class));
+ Matchers.any(HttpResponse.class), Matchers.any(HttpContext.class));
final HttpException httpex = new HttpException();
try {
this.protocolHandler.exception(this.conn, httpex);
@@ -245,7 +246,7 @@ public class TestHttpAsyncService {
this.connContext.setAttribute(HttpAsyncService.HTTP_EXCHANGE_STATE, state);
Mockito.doThrow(new IOException()).when(this.httpProcessor).process(
- Mockito.any(HttpResponse.class), Mockito.any(HttpContext.class));
+ Matchers.any(HttpResponse.class), Matchers.any(HttpContext.class));
final HttpException httpex = new HttpException();
this.protocolHandler.exception(this.conn, httpex);
@@ -295,7 +296,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(
- Mockito.eq(request), Mockito.any(HttpContext.class))).thenReturn(this.requestConsumer);
+ Matchers.eq(request), Matchers.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);
@@ -309,7 +310,7 @@ public class TestHttpAsyncService {
Assert.assertNull(incoming);
final ArgumentCaptor<HttpContext> argumentCaptor = ArgumentCaptor.forClass(HttpContext.class);
- Mockito.verify(this.httpProcessor).process(Mockito.eq(request), argumentCaptor.capture());
+ Mockito.verify(this.httpProcessor).process(Matchers.eq(request), argumentCaptor.capture());
final HttpContext exchangeContext = argumentCaptor.getValue();
Assert.assertNotNull(exchangeContext);
@@ -338,7 +339,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(
- Mockito.eq(request), Mockito.any(HttpContext.class))).thenReturn(this.requestConsumer);
+ Matchers.eq(request), Matchers.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);
@@ -352,11 +353,11 @@ public class TestHttpAsyncService {
Assert.assertNull(incoming);
Mockito.verify(this.requestConsumer).requestReceived(request);
- Mockito.verify(this.requestConsumer).requestCompleted(Mockito.<HttpContext>any());
+ Mockito.verify(this.requestConsumer).requestCompleted(Matchers.<HttpContext>any());
Mockito.verify(this.requestHandler, Mockito.never()).handle(
- Mockito.any(),
- Mockito.any(HttpAsyncExchange.class),
- Mockito.any(HttpContext.class));
+ Matchers.any(),
+ Matchers.any(HttpAsyncExchange.class),
+ Matchers.any(HttpContext.class));
Assert.assertFalse(state.getPipeline().isEmpty());
final PipelineEntry entry = state.getPipeline().remove();
@@ -383,7 +384,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(
- Mockito.eq(request), Mockito.any(HttpContext.class))).thenReturn(this.requestConsumer);
+ Matchers.eq(request), Matchers.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);
@@ -397,11 +398,11 @@ public class TestHttpAsyncService {
Assert.assertNull(incoming);
Mockito.verify(this.requestConsumer).requestReceived(request);
- Mockito.verify(this.requestConsumer).requestCompleted(Mockito.<HttpContext>any());
+ Mockito.verify(this.requestConsumer).requestCompleted(Matchers.<HttpContext>any());
Mockito.verify(this.requestHandler, Mockito.never()).handle(
- Mockito.any(),
- Mockito.any(HttpAsyncExchange.class),
- Mockito.any(HttpContext.class));
+ Matchers.any(),
+ Matchers.any(HttpAsyncExchange.class),
+ Matchers.any(HttpContext.class));
Assert.assertFalse(state.getPipeline().isEmpty());
final PipelineEntry entry1 = state.getPipeline().remove();
@@ -421,7 +422,7 @@ public class TestHttpAsyncService {
request.setEntity(new NStringEntity("stuff"));
Mockito.when(this.conn.getHttpRequest()).thenReturn(request);
Mockito.when(this.requestHandler.processRequest(
- Mockito.eq(request), Mockito.any(HttpContext.class))).thenReturn(this.requestConsumer);
+ Matchers.eq(request), Matchers.any(HttpContext.class))).thenReturn(this.requestConsumer);
this.protocolHandler.requestReceived(this.conn);
@@ -443,7 +444,7 @@ public class TestHttpAsyncService {
HttpVersion.HTTP_1_1);
Mockito.when(this.conn.getHttpRequest()).thenReturn(request);
Mockito.when(this.requestHandler.processRequest(
- Mockito.eq(request), Mockito.any(HttpContext.class))).thenReturn(this.requestConsumer);
+ Matchers.eq(request), Matchers.any(HttpContext.class))).thenReturn(this.requestConsumer);
this.protocolHandler.requestReceived(this.conn);
@@ -477,7 +478,7 @@ public class TestHttpAsyncService {
request.addHeader(HTTP.EXPECT_DIRECTIVE, HTTP.EXPECT_CONTINUE);
Mockito.when(this.conn.getHttpRequest()).thenReturn(request);
Mockito.when(this.requestHandler.processRequest(
- Mockito.eq(request), Mockito.any(HttpContext.class))).thenReturn(this.requestConsumer);
+ Matchers.eq(request), Matchers.any(HttpContext.class))).thenReturn(this.requestConsumer);
this.protocolHandler.requestReceived(this.conn);
@@ -499,7 +500,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(Mockito.argThat(new ArgumentMatcher<HttpResponse>() {
+ Mockito.verify(this.conn).submitResponse(Matchers.argThat(new ArgumentMatcher<HttpResponse>() {
@Override
public boolean matches(final Object argument) {
@@ -525,7 +526,7 @@ public class TestHttpAsyncService {
request.addHeader(HTTP.EXPECT_DIRECTIVE, HTTP.EXPECT_CONTINUE);
Mockito.when(this.conn.getHttpRequest()).thenReturn(request);
Mockito.when(this.requestHandler.processRequest(
- Mockito.eq(request), Mockito.any(HttpContext.class))).thenReturn(this.requestConsumer);
+ Matchers.eq(request), Matchers.any(HttpContext.class))).thenReturn(this.requestConsumer);
this.protocolHandler.requestReceived(this.conn);
@@ -548,8 +549,8 @@ public class TestHttpAsyncService {
Mockito.verify(this.requestConsumer).requestReceived(request);
Mockito.verify(this.conn).suspendInput();
Mockito.verify(expectationVerifier).verify(
- Mockito.any(HttpAsyncExchange.class),
- Mockito.eq(exchangeContext));
+ Matchers.any(HttpAsyncExchange.class),
+ Matchers.eq(exchangeContext));
}
@Test
@@ -609,7 +610,7 @@ public class TestHttpAsyncService {
Mockito.when(this.conn.getHttpRequest()).thenReturn(request);
Mockito.when(this.requestHandler.processRequest(
- Mockito.eq(request), Mockito.any(HttpContext.class))).thenReturn(this.requestConsumer);
+ Matchers.eq(request), Matchers.any(HttpContext.class))).thenReturn(this.requestConsumer);
this.protocolHandler.requestReceived(this.conn);
@@ -641,7 +642,7 @@ public class TestHttpAsyncService {
Mockito.when(this.conn.getHttpRequest()).thenReturn(request);
Mockito.when(this.requestHandler.processRequest(
- Mockito.eq(request), Mockito.any(HttpContext.class))).thenReturn(this.requestConsumer);
+ Matchers.eq(request), Matchers.any(HttpContext.class))).thenReturn(this.requestConsumer);
this.protocolHandler.requestReceived(this.conn);
@@ -669,7 +670,7 @@ public class TestHttpAsyncService {
Mockito.when(this.conn.getContext()).thenReturn(this.connContext);
Mockito.when(this.conn.getHttpRequest()).thenReturn(request);
Mockito.when(this.requestHandler.processRequest(
- Mockito.eq(request), Mockito.any(HttpContext.class))).thenReturn(this.requestConsumer);
+ Matchers.eq(request), Matchers.any(HttpContext.class))).thenReturn(this.requestConsumer);
Mockito.when(((SessionBufferStatus) this.conn).hasBufferedInput()).thenReturn(Boolean.TRUE);
this.protocolHandler.requestReceived(this.conn);
@@ -1016,7 +1017,7 @@ public class TestHttpAsyncService {
Assert.assertEquals(MessageState.READY, state.getResponseState());
Mockito.verify(this.conn).requestInput();
- Mockito.verify(this.conn).submitResponse(Mockito.argThat(new ArgumentMatcher<HttpResponse>() {
+ Mockito.verify(this.conn).submitResponse(Matchers.argThat(new ArgumentMatcher<HttpResponse>() {
@Override
public boolean matches(final Object argument) {
@@ -1095,8 +1096,8 @@ public class TestHttpAsyncService {
Assert.assertNull(state.getOutgoing());
final ArgumentCaptor<HttpAsyncExchange> argCaptor = ArgumentCaptor.forClass(HttpAsyncExchange.class);
- Mockito.verify(this.requestHandler).handle(Mockito.same(request),
- argCaptor.capture(), Mockito.same(exchangeContext));
+ Mockito.verify(this.requestHandler).handle(Matchers.same(request),
+ argCaptor.capture(), Matchers.same(exchangeContext));
final HttpAsyncExchange exchange = argCaptor.getValue();
Assert.assertNotNull(exchange);
@@ -1130,9 +1131,9 @@ public class TestHttpAsyncService {
Assert.assertNotNull(response);
Assert.assertEquals(500, response.getStatusLine().getStatusCode());
- Mockito.verify(this.requestHandler, Mockito.never()).handle(Mockito.<HttpRequest>any(),
- Mockito.<HttpAsyncExchange>any(), Mockito.<HttpContext>any());
- Mockito.verify(this.conn).submitResponse(Mockito.same(response));
+ Mockito.verify(this.requestHandler, Mockito.never()).handle(Matchers.<HttpRequest>any(),
+ Matchers.<HttpAsyncExchange>any(), Matchers.<HttpContext>any());
+ Mockito.verify(this.conn).submitResponse(Matchers.same(response));
}
@Test(expected=HttpException.class)
@@ -1311,7 +1312,7 @@ public class TestHttpAsyncService {
this.protocolHandler.endOfInput(this.conn);
- Mockito.verify(this.conn, Mockito.never()).setSocketTimeout(Mockito.anyInt());
+ Mockito.verify(this.conn, Mockito.never()).setSocketTimeout(Matchers.anyInt());
Mockito.verify(this.conn).close();
}
@@ -1330,19 +1331,19 @@ public class TestHttpAsyncService {
public void testTimeoutActiveConnection() throws Exception {
final State state = new State();
this.connContext.setAttribute(HttpAsyncService.HTTP_EXCHANGE_STATE, state);
- Mockito.when(this.conn.getStatus()).thenReturn(NHttpClientConnection.ACTIVE, NHttpClientConnection.CLOSED);
+ Mockito.when(this.conn.getStatus()).thenReturn(NHttpConnection.ACTIVE, NHttpConnection.CLOSED);
this.protocolHandler.timeout(this.conn);
Mockito.verify(this.conn).close();
- Mockito.verify(this.conn, Mockito.never()).setSocketTimeout(Mockito.anyInt());
+ Mockito.verify(this.conn, Mockito.never()).setSocketTimeout(Matchers.anyInt());
}
@Test
public void testTimeoutActiveConnectionBufferedData() throws Exception {
final State state = new State();
this.connContext.setAttribute(HttpAsyncService.HTTP_EXCHANGE_STATE, state);
- Mockito.when(this.conn.getStatus()).thenReturn(NHttpClientConnection.ACTIVE, NHttpClientConnection.CLOSING);
+ Mockito.when(this.conn.getStatus()).thenReturn(NHttpConnection.ACTIVE, NHttpConnection.CLOSING);
this.protocolHandler.timeout(this.conn);
@@ -1363,14 +1364,14 @@ public class TestHttpAsyncService {
request, response, this.responseProducer, exchangeContext);
state.setOutgoing(outgoing);
this.connContext.setAttribute(HttpAsyncService.HTTP_EXCHANGE_STATE, state);
- Mockito.when(this.conn.getStatus()).thenReturn(NHttpClientConnection.CLOSING);
+ Mockito.when(this.conn.getStatus()).thenReturn(NHttpConnection.CLOSING);
this.protocolHandler.timeout(this.conn);
Mockito.verify(this.conn).shutdown();
- Mockito.verify(this.requestConsumer).failed(Mockito.any(SocketTimeoutException.class));
+ Mockito.verify(this.requestConsumer).failed(Matchers.any(SocketTimeoutException.class));
Mockito.verify(this.requestConsumer).close();
- Mockito.verify(this.responseProducer).failed(Mockito.any(SocketTimeoutException.class));
+ Mockito.verify(this.responseProducer).failed(Matchers.any(SocketTimeoutException.class));
Mockito.verify(this.responseProducer).close();
}
[2/2] httpcomponents-core git commit: Access static methods with the
class that defines them, not a subclass.
Posted by gg...@apache.org.
Access static methods with the class that defines them, not a subclass.
Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/4e99c599
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/4e99c599
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/4e99c599
Branch: refs/heads/4.4.x
Commit: 4e99c599b3632f2d625e91593c815ffb4d4bbb7f
Parents: 442d260
Author: Gary Gregory <ga...@gmail.com>
Authored: Sat Sep 2 14:05:08 2017 -0600
Committer: Gary Gregory <ga...@gmail.com>
Committed: Sat Sep 2 14:05:08 2017 -0600
----------------------------------------------------------------------
.../nio/TestDefaultNHttpClientConnection.java | 104 +++++------
.../nio/TestDefaultNHttpServerConnection.java | 104 +++++------
.../http/impl/nio/codecs/TestChunkEncoder.java | 3 +-
.../impl/nio/codecs/TestIdentityEncoder.java | 45 ++---
.../nio/codecs/TestLengthDelimitedEncoder.java | 49 ++---
.../impl/nio/pool/TestBasicNIOConnPool.java | 9 +-
.../apache/http/nio/pool/TestNIOConnPool.java | 187 ++++++++++---------
.../protocol/TestBasicAsyncRequestHandler.java | 3 +-
.../protocol/TestHttpAsyncRequestExecutor.java | 15 +-
.../nio/protocol/TestHttpAsyncRequester.java | 17 +-
.../http/nio/protocol/TestHttpAsyncService.java | 77 ++++----
11 files changed, 311 insertions(+), 302 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/4e99c599/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpClientConnection.java
----------------------------------------------------------------------
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 374963e..3cb35d2 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
@@ -180,7 +180,7 @@ public class TestDefaultNHttpClientConnection {
Assert.assertEquals(19, conn.outbuf.length());
Mockito.doAnswer(new ProduceContentAnswer(entity)).when(
- handler).outputReady(Mockito.<NHttpClientConnection>any(), Mockito.<ContentEncoder>any());
+ handler).outputReady(Matchers.<NHttpClientConnection>any(), Matchers.<ContentEncoder>any());
conn.produceOutput(handler);
@@ -205,7 +205,7 @@ public class TestDefaultNHttpClientConnection {
Assert.assertEquals(19, conn.outbuf.length());
Mockito.doAnswer(new ProduceContentAnswer(entity)).when(
- handler).outputReady(Mockito.<NHttpClientConnection>any(), Mockito.<ContentEncoder>any());
+ handler).outputReady(Matchers.<NHttpClientConnection>any(), Matchers.<ContentEncoder>any());
conn.produceOutput(handler);
@@ -227,10 +227,10 @@ public class TestDefaultNHttpClientConnection {
Mockito.when(session.channel()).thenReturn(channel);
Mockito.doAnswer(new RequestReadyAnswer(request)).when(
- handler).requestReady(Mockito.<NHttpClientConnection>any());
+ handler).requestReady(Matchers.<NHttpClientConnection>any());
Mockito.doAnswer(new ProduceContentAnswer(entity)).when(
- handler).outputReady(Mockito.<NHttpClientConnection>any(), Mockito.<ContentEncoder>any());
+ handler).outputReady(Matchers.<NHttpClientConnection>any(), Matchers.<ContentEncoder>any());
conn.produceOutput(handler);
@@ -252,10 +252,10 @@ public class TestDefaultNHttpClientConnection {
Mockito.when(session.channel()).thenReturn(channel);
Mockito.doAnswer(new RequestReadyAnswer(request)).when(
- handler).requestReady(Mockito.<NHttpClientConnection>any());
+ handler).requestReady(Matchers.<NHttpClientConnection>any());
Mockito.doAnswer(new ProduceContentAnswer(entity)).when(
- handler).outputReady(Mockito.<NHttpClientConnection>any(), Mockito.<ContentEncoder>any());
+ handler).outputReady(Matchers.<NHttpClientConnection>any(), Matchers.<ContentEncoder>any());
conn.produceOutput(handler);
@@ -277,10 +277,10 @@ public class TestDefaultNHttpClientConnection {
Mockito.when(session.channel()).thenReturn(channel);
Mockito.doAnswer(new RequestReadyAnswer(request)).when(
- handler).requestReady(Mockito.<NHttpClientConnection>any());
+ handler).requestReady(Matchers.<NHttpClientConnection>any());
Mockito.doAnswer(new ProduceContentAnswer(entity)).when(
- handler).outputReady(Mockito.<NHttpClientConnection>any(), Mockito.<ContentEncoder>any());
+ handler).outputReady(Matchers.<NHttpClientConnection>any(), Matchers.<ContentEncoder>any());
conn.produceOutput(handler);
@@ -305,10 +305,10 @@ public class TestDefaultNHttpClientConnection {
Mockito.when(session.channel()).thenReturn(channel);
Mockito.doAnswer(new RequestReadyAnswer(request)).when(
- handler).requestReady(Mockito.<NHttpClientConnection>any());
+ handler).requestReady(Matchers.<NHttpClientConnection>any());
Mockito.doAnswer(new ProduceContentAnswer(entity)).when(
- handler).outputReady(Mockito.<NHttpClientConnection>any(), Mockito.<ContentEncoder>any());
+ handler).outputReady(Matchers.<NHttpClientConnection>any(), Matchers.<ContentEncoder>any());
conn.produceOutput(handler);
@@ -335,10 +335,10 @@ public class TestDefaultNHttpClientConnection {
Mockito.when(session.channel()).thenReturn(channel);
Mockito.doAnswer(new RequestReadyAnswer(request)).when(
- handler).requestReady(Mockito.<NHttpClientConnection>any());
+ handler).requestReady(Matchers.<NHttpClientConnection>any());
Mockito.doAnswer(new ProduceContentAnswer(entity)).when(
- handler).outputReady(Mockito.<NHttpClientConnection>any(), Mockito.<ContentEncoder>any());
+ handler).outputReady(Matchers.<NHttpClientConnection>any(), Matchers.<ContentEncoder>any());
conn.produceOutput(handler);
@@ -365,10 +365,10 @@ public class TestDefaultNHttpClientConnection {
Mockito.when(session.channel()).thenReturn(channel);
Mockito.doAnswer(new RequestReadyAnswer(request)).when(
- handler).requestReady(Mockito.<NHttpClientConnection>any());
+ handler).requestReady(Matchers.<NHttpClientConnection>any());
Mockito.doAnswer(new ProduceContentAnswer(entity)).when(
- handler).outputReady(Mockito.<NHttpClientConnection>any(), Mockito.<ContentEncoder>any());
+ handler).outputReady(Matchers.<NHttpClientConnection>any(), Matchers.<ContentEncoder>any());
conn.produceOutput(handler);
@@ -403,9 +403,9 @@ public class TestDefaultNHttpClientConnection {
Mockito.verify(session, Mockito.times(1)).close();
Mockito.verify(session, Mockito.never()).clearEvent(SelectionKey.OP_WRITE);
Mockito.verify(handler, Mockito.never()).requestReady(
- Mockito.<NHttpClientConnection>any());
+ Matchers.<NHttpClientConnection>any());
Mockito.verify(handler, Mockito.never()).outputReady(
- Mockito.<NHttpClientConnection>any(), Mockito.<ContentEncoder>any());
+ Matchers.<NHttpClientConnection>any(), Matchers.<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(Mockito.<NHttpClientConnection>any());
+ handler).responseReceived(Matchers.<NHttpClientConnection>any());
Mockito.doAnswer(new ConsumeContentAnswer(new SimpleInputBuffer(64))).when(
- handler).inputReady(Mockito.<NHttpClientConnection>any(), Mockito.<ContentDecoder>any());
+ handler).inputReady(Matchers.<NHttpClientConnection>any(), Matchers.<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(
- Mockito.<NHttpClientConnection>any());
+ Matchers.<NHttpClientConnection>any());
Mockito.verify(handler, Mockito.times(1)).inputReady(
- Mockito.<NHttpClientConnection>any(), Mockito.<LengthDelimitedDecoder>any());
- Mockito.verify(rchannel, Mockito.times(2)).read(Mockito.<ByteBuffer>any());
+ Matchers.<NHttpClientConnection>any(), Matchers.<LengthDelimitedDecoder>any());
+ Mockito.verify(rchannel, Mockito.times(2)).read(Matchers.<ByteBuffer>any());
Mockito.verify(handler, Mockito.never()).exception(
- Mockito.<NHttpClientConnection>any(), Mockito.<Exception>any());
+ Matchers.<NHttpClientConnection>any(), Matchers.<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(Mockito.<NHttpClientConnection>any());
+ handler).responseReceived(Matchers.<NHttpClientConnection>any());
Mockito.doAnswer(new ConsumeContentAnswer(new SimpleInputBuffer(64))).when(
- handler).inputReady(Mockito.<NHttpClientConnection>any(), Mockito.<ContentDecoder>any());
+ handler).inputReady(Matchers.<NHttpClientConnection>any(), Matchers.<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(
- Mockito.<NHttpClientConnection>any());
+ Matchers.<NHttpClientConnection>any());
Mockito.verify(handler, Mockito.times(1)).inputReady(
- Mockito.<NHttpClientConnection>any(), Mockito.<LengthDelimitedDecoder>any());
- Mockito.verify(rchannel, Mockito.times(2)).read(Mockito.<ByteBuffer>any());
+ Matchers.<NHttpClientConnection>any(), Matchers.<LengthDelimitedDecoder>any());
+ Mockito.verify(rchannel, Mockito.times(2)).read(Matchers.<ByteBuffer>any());
Mockito.verify(handler, Mockito.never()).exception(
- Mockito.<NHttpClientConnection>any(), Mockito.<Exception>any());
+ Matchers.<NHttpClientConnection>any(), Matchers.<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(Mockito.<ByteBuffer>any());
+ Mockito.verify(rchannel, Mockito.times(3)).read(Matchers.<ByteBuffer>any());
Mockito.verify(handler, Mockito.never()).exception(
- Mockito.<NHttpClientConnection>any(), Mockito.<Exception>any());
+ Matchers.<NHttpClientConnection>any(), Matchers.<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(Mockito.<NHttpClientConnection>any());
+ handler).responseReceived(Matchers.<NHttpClientConnection>any());
Mockito.doAnswer(new ConsumeContentAnswer(new SimpleInputBuffer(64))).when(
- handler).inputReady(Mockito.<NHttpClientConnection>any(), Mockito.<ContentDecoder>any());
+ handler).inputReady(Matchers.<NHttpClientConnection>any(), Matchers.<ContentDecoder>any());
conn.consumeInput(handler);
@@ -569,12 +569,12 @@ public class TestDefaultNHttpClientConnection {
Assert.assertNull(conn.contentDecoder);
Mockito.verify(handler, Mockito.times(1)).responseReceived(
- Mockito.<NHttpClientConnection>any());
+ Matchers.<NHttpClientConnection>any());
Mockito.verify(handler, Mockito.never()).inputReady(
- Mockito.<NHttpClientConnection>any(), Mockito.<LengthDelimitedDecoder>any());
- Mockito.verify(rchannel, Mockito.times(1)).read(Mockito.<ByteBuffer>any());
+ Matchers.<NHttpClientConnection>any(), Matchers.<LengthDelimitedDecoder>any());
+ Mockito.verify(rchannel, Mockito.times(1)).read(Matchers.<ByteBuffer>any());
Mockito.verify(handler, Mockito.never()).exception(
- Mockito.<NHttpClientConnection>any(), Mockito.<Exception>any());
+ Matchers.<NHttpClientConnection>any(), Matchers.<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(Mockito.<NHttpClientConnection>any());
+ handler).responseReceived(Matchers.<NHttpClientConnection>any());
Mockito.doAnswer(new ConsumeContentAnswer(new SimpleInputBuffer(64))).when(
- handler).inputReady(Mockito.<NHttpClientConnection>any(), Mockito.<ContentDecoder>any());
+ handler).inputReady(Matchers.<NHttpClientConnection>any(), Matchers.<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(
- Mockito.<NHttpClientConnection>any());
+ Matchers.<NHttpClientConnection>any());
Mockito.verify(handler, Mockito.never()).inputReady(
- Mockito.<NHttpClientConnection>any(), Mockito.<LengthDelimitedDecoder>any());
- Mockito.verify(rchannel, Mockito.times(1)).read(Mockito.<ByteBuffer>any());
+ Matchers.<NHttpClientConnection>any(), Matchers.<LengthDelimitedDecoder>any());
+ Mockito.verify(rchannel, Mockito.times(1)).read(Matchers.<ByteBuffer>any());
Mockito.verify(handler, Mockito.never()).exception(
- Mockito.<NHttpClientConnection>any(), Mockito.<Exception>any());
+ Matchers.<NHttpClientConnection>any(), Matchers.<Exception>any());
conn.consumeInput(handler);
@@ -626,12 +626,12 @@ public class TestDefaultNHttpClientConnection {
Assert.assertEquals(0, conn.getMetrics().getReceivedBytesCount());
Mockito.verify(handler, Mockito.never()).responseReceived(
- Mockito.<NHttpClientConnection>any());
+ Matchers.<NHttpClientConnection>any());
Mockito.verify(handler, Mockito.never()).inputReady(
- Mockito.<NHttpClientConnection>any(), Mockito.<LengthDelimitedDecoder>any());
- Mockito.verify(rchannel, Mockito.times(2)).read(Mockito.<ByteBuffer>any());
+ Matchers.<NHttpClientConnection>any(), Matchers.<LengthDelimitedDecoder>any());
+ Mockito.verify(rchannel, Mockito.times(2)).read(Matchers.<ByteBuffer>any());
Mockito.verify(handler, Mockito.never()).exception(
- Mockito.<NHttpClientConnection>any(), Mockito.<Exception>any());
+ Matchers.<NHttpClientConnection>any(), Matchers.<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(
- Mockito.<NHttpClientConnection>any());
+ Matchers.<NHttpClientConnection>any());
Mockito.verify(handler, Mockito.never()).inputReady(
- Mockito.<NHttpClientConnection>any(), Mockito.<LengthDelimitedDecoder>any());
- Mockito.verify(rchannel, Mockito.times(3)).read(Mockito.<ByteBuffer>any());
+ Matchers.<NHttpClientConnection>any(), Matchers.<LengthDelimitedDecoder>any());
+ Mockito.verify(rchannel, Mockito.times(3)).read(Matchers.<ByteBuffer>any());
Mockito.verify(handler, Mockito.times(1)).endOfInput(
- Mockito.<NHttpClientConnection>any());
+ Matchers.<NHttpClientConnection>any());
Mockito.verify(handler, Mockito.never()).exception(
- Mockito.<NHttpClientConnection>any(), Mockito.<Exception>any());
+ Matchers.<NHttpClientConnection>any(), Matchers.<Exception>any());
}
@@ -662,7 +662,7 @@ public class TestDefaultNHttpClientConnection {
conn.close();
conn.consumeInput(handler);
- Mockito.verify(rchannel, Mockito.never()).read(Mockito.<ByteBuffer>any());
+ Mockito.verify(rchannel, Mockito.never()).read(Matchers.<ByteBuffer>any());
Mockito.verify(session, Mockito.times(1)).clearEvent(SelectionKey.OP_READ);
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/4e99c599/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpServerConnection.java
----------------------------------------------------------------------
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 08cd498..7887683 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
@@ -180,7 +180,7 @@ public class TestDefaultNHttpServerConnection {
Assert.assertEquals(19, conn.outbuf.length());
Mockito.doAnswer(new ProduceContentAnswer(entity)).when(
- handler).outputReady(Mockito.<NHttpServerConnection>any(), Mockito.<ContentEncoder>any());
+ handler).outputReady(Matchers.<NHttpServerConnection>any(), Matchers.<ContentEncoder>any());
conn.produceOutput(handler);
@@ -205,7 +205,7 @@ public class TestDefaultNHttpServerConnection {
Assert.assertEquals(19, conn.outbuf.length());
Mockito.doAnswer(new ProduceContentAnswer(entity)).when(
- handler).outputReady(Mockito.<NHttpServerConnection>any(), Mockito.<ContentEncoder>any());
+ handler).outputReady(Matchers.<NHttpServerConnection>any(), Matchers.<ContentEncoder>any());
conn.produceOutput(handler);
@@ -227,10 +227,10 @@ public class TestDefaultNHttpServerConnection {
Mockito.when(session.channel()).thenReturn(channel);
Mockito.doAnswer(new ResponseReadyAnswer(response)).when(
- handler).responseReady(Mockito.<NHttpServerConnection>any());
+ handler).responseReady(Matchers.<NHttpServerConnection>any());
Mockito.doAnswer(new ProduceContentAnswer(entity)).when(
- handler).outputReady(Mockito.<NHttpServerConnection>any(), Mockito.<ContentEncoder>any());
+ handler).outputReady(Matchers.<NHttpServerConnection>any(), Matchers.<ContentEncoder>any());
conn.produceOutput(handler);
@@ -252,10 +252,10 @@ public class TestDefaultNHttpServerConnection {
Mockito.when(session.channel()).thenReturn(channel);
Mockito.doAnswer(new ResponseReadyAnswer(response)).when(
- handler).responseReady(Mockito.<NHttpServerConnection>any());
+ handler).responseReady(Matchers.<NHttpServerConnection>any());
Mockito.doAnswer(new ProduceContentAnswer(entity)).when(
- handler).outputReady(Mockito.<NHttpServerConnection>any(), Mockito.<ContentEncoder>any());
+ handler).outputReady(Matchers.<NHttpServerConnection>any(), Matchers.<ContentEncoder>any());
conn.produceOutput(handler);
@@ -277,10 +277,10 @@ public class TestDefaultNHttpServerConnection {
Mockito.when(session.channel()).thenReturn(channel);
Mockito.doAnswer(new ResponseReadyAnswer(response)).when(
- handler).responseReady(Mockito.<NHttpServerConnection>any());
+ handler).responseReady(Matchers.<NHttpServerConnection>any());
Mockito.doAnswer(new ProduceContentAnswer(entity)).when(
- handler).outputReady(Mockito.<NHttpServerConnection>any(), Mockito.<ContentEncoder>any());
+ handler).outputReady(Matchers.<NHttpServerConnection>any(), Matchers.<ContentEncoder>any());
conn.produceOutput(handler);
@@ -305,10 +305,10 @@ public class TestDefaultNHttpServerConnection {
Mockito.when(session.channel()).thenReturn(channel);
Mockito.doAnswer(new ResponseReadyAnswer(response)).when(
- handler).responseReady(Mockito.<NHttpServerConnection>any());
+ handler).responseReady(Matchers.<NHttpServerConnection>any());
Mockito.doAnswer(new ProduceContentAnswer(entity)).when(
- handler).outputReady(Mockito.<NHttpServerConnection>any(), Mockito.<ContentEncoder>any());
+ handler).outputReady(Matchers.<NHttpServerConnection>any(), Matchers.<ContentEncoder>any());
conn.produceOutput(handler);
@@ -335,10 +335,10 @@ public class TestDefaultNHttpServerConnection {
Mockito.when(session.channel()).thenReturn(channel);
Mockito.doAnswer(new ResponseReadyAnswer(response)).when(
- handler).responseReady(Mockito.<NHttpServerConnection>any());
+ handler).responseReady(Matchers.<NHttpServerConnection>any());
Mockito.doAnswer(new ProduceContentAnswer(entity)).when(
- handler).outputReady(Mockito.<NHttpServerConnection>any(), Mockito.<ContentEncoder>any());
+ handler).outputReady(Matchers.<NHttpServerConnection>any(), Matchers.<ContentEncoder>any());
conn.produceOutput(handler);
@@ -365,10 +365,10 @@ public class TestDefaultNHttpServerConnection {
Mockito.when(session.channel()).thenReturn(channel);
Mockito.doAnswer(new ResponseReadyAnswer(response)).when(
- handler).responseReady(Mockito.<NHttpServerConnection>any());
+ handler).responseReady(Matchers.<NHttpServerConnection>any());
Mockito.doAnswer(new ProduceContentAnswer(entity)).when(
- handler).outputReady(Mockito.<NHttpServerConnection>any(), Mockito.<ContentEncoder>any());
+ handler).outputReady(Matchers.<NHttpServerConnection>any(), Matchers.<ContentEncoder>any());
conn.produceOutput(handler);
@@ -403,9 +403,9 @@ public class TestDefaultNHttpServerConnection {
Mockito.verify(session, Mockito.times(1)).close();
Mockito.verify(session, Mockito.never()).clearEvent(SelectionKey.OP_WRITE);
Mockito.verify(handler, Mockito.never()).responseReady(
- Mockito.<NHttpServerConnection>any());
+ Matchers.<NHttpServerConnection>any());
Mockito.verify(handler, Mockito.never()).outputReady(
- Mockito.<NHttpServerConnection>any(), Mockito.<ContentEncoder>any());
+ Matchers.<NHttpServerConnection>any(), Matchers.<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(Mockito.<NHttpServerConnection>any());
+ handler).requestReceived(Matchers.<NHttpServerConnection>any());
Mockito.doAnswer(new ConsumeContentAnswer(new SimpleInputBuffer(64))).when(
- handler).inputReady(Mockito.<NHttpServerConnection>any(), Mockito.<ContentDecoder>any());
+ handler).inputReady(Matchers.<NHttpServerConnection>any(), Matchers.<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(
- Mockito.<NHttpServerConnection>any());
+ Matchers.<NHttpServerConnection>any());
Mockito.verify(handler, Mockito.times(1)).inputReady(
- Mockito.<NHttpServerConnection>any(), Mockito.<LengthDelimitedDecoder>any());
- Mockito.verify(rchannel, Mockito.times(2)).read(Mockito.<ByteBuffer>any());
+ Matchers.<NHttpServerConnection>any(), Matchers.<LengthDelimitedDecoder>any());
+ Mockito.verify(rchannel, Mockito.times(2)).read(Matchers.<ByteBuffer>any());
Mockito.verify(handler, Mockito.never()).exception(
- Mockito.<NHttpServerConnection>any(), Mockito.<Exception>any());
+ Matchers.<NHttpServerConnection>any(), Matchers.<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(Mockito.<NHttpServerConnection>any());
+ handler).requestReceived(Matchers.<NHttpServerConnection>any());
Mockito.doAnswer(new ConsumeContentAnswer(new SimpleInputBuffer(64))).when(
- handler).inputReady(Mockito.<NHttpServerConnection>any(), Mockito.<ContentDecoder>any());
+ handler).inputReady(Matchers.<NHttpServerConnection>any(), Matchers.<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(
- Mockito.<NHttpServerConnection>any());
+ Matchers.<NHttpServerConnection>any());
Mockito.verify(handler, Mockito.times(1)).inputReady(
- Mockito.<NHttpServerConnection>any(), Mockito.<LengthDelimitedDecoder>any());
- Mockito.verify(rchannel, Mockito.times(2)).read(Mockito.<ByteBuffer>any());
+ Matchers.<NHttpServerConnection>any(), Matchers.<LengthDelimitedDecoder>any());
+ Mockito.verify(rchannel, Mockito.times(2)).read(Matchers.<ByteBuffer>any());
Mockito.verify(handler, Mockito.never()).exception(
- Mockito.<NHttpServerConnection>any(), Mockito.<Exception>any());
+ Matchers.<NHttpServerConnection>any(), Matchers.<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(Mockito.<ByteBuffer>any());
+ Mockito.verify(rchannel, Mockito.times(3)).read(Matchers.<ByteBuffer>any());
Mockito.verify(handler, Mockito.never()).exception(
- Mockito.<NHttpServerConnection>any(), Mockito.<Exception>any());
+ Matchers.<NHttpServerConnection>any(), Matchers.<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(Mockito.<NHttpServerConnection>any());
+ handler).requestReceived(Matchers.<NHttpServerConnection>any());
Mockito.doAnswer(new ConsumeContentAnswer(new SimpleInputBuffer(64))).when(
- handler).inputReady(Mockito.<NHttpServerConnection>any(), Mockito.<ContentDecoder>any());
+ handler).inputReady(Matchers.<NHttpServerConnection>any(), Matchers.<ContentDecoder>any());
conn.consumeInput(handler);
@@ -571,12 +571,12 @@ public class TestDefaultNHttpServerConnection {
Assert.assertNull(conn.contentDecoder);
Mockito.verify(handler, Mockito.times(1)).requestReceived(
- Mockito.<NHttpServerConnection>any());
+ Matchers.<NHttpServerConnection>any());
Mockito.verify(handler, Mockito.never()).inputReady(
- Mockito.<NHttpServerConnection>any(), Mockito.<LengthDelimitedDecoder>any());
- Mockito.verify(rchannel, Mockito.times(1)).read(Mockito.<ByteBuffer>any());
+ Matchers.<NHttpServerConnection>any(), Matchers.<LengthDelimitedDecoder>any());
+ Mockito.verify(rchannel, Mockito.times(1)).read(Matchers.<ByteBuffer>any());
Mockito.verify(handler, Mockito.never()).exception(
- Mockito.<NHttpServerConnection>any(), Mockito.<Exception>any());
+ Matchers.<NHttpServerConnection>any(), Matchers.<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(Mockito.<NHttpServerConnection>any());
+ handler).requestReceived(Matchers.<NHttpServerConnection>any());
Mockito.doAnswer(new ConsumeContentAnswer(new SimpleInputBuffer(64))).when(
- handler).inputReady(Mockito.<NHttpServerConnection>any(), Mockito.<ContentDecoder>any());
+ handler).inputReady(Matchers.<NHttpServerConnection>any(), Matchers.<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(
- Mockito.<NHttpServerConnection>any());
+ Matchers.<NHttpServerConnection>any());
Mockito.verify(handler, Mockito.never()).inputReady(
- Mockito.<NHttpServerConnection>any(), Mockito.<LengthDelimitedDecoder>any());
- Mockito.verify(rchannel, Mockito.times(1)).read(Mockito.<ByteBuffer>any());
+ Matchers.<NHttpServerConnection>any(), Matchers.<LengthDelimitedDecoder>any());
+ Mockito.verify(rchannel, Mockito.times(1)).read(Matchers.<ByteBuffer>any());
Mockito.verify(handler, Mockito.never()).exception(
- Mockito.<NHttpServerConnection>any(), Mockito.<Exception>any());
+ Matchers.<NHttpServerConnection>any(), Matchers.<Exception>any());
conn.consumeInput(handler);
@@ -628,12 +628,12 @@ public class TestDefaultNHttpServerConnection {
Assert.assertEquals(0, conn.getMetrics().getReceivedBytesCount());
Mockito.verify(handler, Mockito.never()).requestReceived(
- Mockito.<NHttpServerConnection>any());
+ Matchers.<NHttpServerConnection>any());
Mockito.verify(handler, Mockito.never()).inputReady(
- Mockito.<NHttpServerConnection>any(), Mockito.<LengthDelimitedDecoder>any());
- Mockito.verify(rchannel, Mockito.times(2)).read(Mockito.<ByteBuffer>any());
+ Matchers.<NHttpServerConnection>any(), Matchers.<LengthDelimitedDecoder>any());
+ Mockito.verify(rchannel, Mockito.times(2)).read(Matchers.<ByteBuffer>any());
Mockito.verify(handler, Mockito.never()).exception(
- Mockito.<NHttpServerConnection>any(), Mockito.<Exception>any());
+ Matchers.<NHttpServerConnection>any(), Matchers.<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(
- Mockito.<NHttpServerConnection>any());
+ Matchers.<NHttpServerConnection>any());
Mockito.verify(handler, Mockito.never()).inputReady(
- Mockito.<NHttpServerConnection>any(), Mockito.<LengthDelimitedDecoder>any());
- Mockito.verify(rchannel, Mockito.times(3)).read(Mockito.<ByteBuffer>any());
+ Matchers.<NHttpServerConnection>any(), Matchers.<LengthDelimitedDecoder>any());
+ Mockito.verify(rchannel, Mockito.times(3)).read(Matchers.<ByteBuffer>any());
Mockito.verify(handler, Mockito.times(1)).endOfInput(
- Mockito.<NHttpServerConnection>any());
+ Matchers.<NHttpServerConnection>any());
Mockito.verify(handler, Mockito.never()).exception(
- Mockito.<NHttpServerConnection>any(), Mockito.<Exception>any());
+ Matchers.<NHttpServerConnection>any(), Matchers.<Exception>any());
}
@@ -664,7 +664,7 @@ public class TestDefaultNHttpServerConnection {
conn.close();
conn.consumeInput(handler);
- Mockito.verify(rchannel, Mockito.never()).read(Mockito.<ByteBuffer>any());
+ Mockito.verify(rchannel, Mockito.never()).read(Matchers.<ByteBuffer>any());
Mockito.verify(session, Mockito.times(1)).clearEvent(SelectionKey.OP_READ);
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/4e99c599/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestChunkEncoder.java
----------------------------------------------------------------------
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 2f17738..d63f2d6 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,6 +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.Mockito;
/**
@@ -125,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(Mockito.<ByteBuffer>any());
+ Mockito.verify(channel, Mockito.never()).write(Matchers.<ByteBuffer>any());
outbuf.flush(channel);
final String s = channel.dump(Consts.ASCII);
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/4e99c599/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestIdentityEncoder.java
----------------------------------------------------------------------
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 c7fc6ba..ccdcb5e 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,6 +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.Mockito;
/**
@@ -311,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(Mockito.<ByteBuffer>any());
- Mockito.verify(outbuf, Mockito.never()).write(Mockito.<ByteBuffer>any());
+ Mockito.verify(channel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(outbuf, Mockito.never()).write(Matchers.<ByteBuffer>any());
Mockito.verify(outbuf, Mockito.times(1)).flush(channel);
Assert.assertEquals(13, metrics.getBytesTransferred());
@@ -333,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(Mockito.<ByteBuffer>any());
- Mockito.verify(outbuf, Mockito.times(1)).write(Mockito.<ByteBuffer>any());
+ Mockito.verify(channel, Mockito.never()).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(outbuf, Mockito.times(1)).write(Matchers.<ByteBuffer>any());
Mockito.verify(outbuf, Mockito.never()).flush(channel);
Assert.assertEquals(0, metrics.getBytesTransferred());
@@ -356,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(Mockito.<ByteBuffer>any());
- Mockito.verify(outbuf, Mockito.times(3)).write(Mockito.<ByteBuffer>any());
+ Mockito.verify(channel, Mockito.never()).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(outbuf, Mockito.times(3)).write(Matchers.<ByteBuffer>any());
Mockito.verify(outbuf, Mockito.never()).flush(channel);
Assert.assertEquals(0, metrics.getBytesTransferred());
@@ -378,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(Mockito.<ByteBuffer>any());
- Mockito.verify(outbuf, Mockito.never()).write(Mockito.<ByteBuffer>any());
+ Mockito.verify(channel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(outbuf, Mockito.never()).write(Matchers.<ByteBuffer>any());
Mockito.verify(outbuf, Mockito.times(1)).flush(channel);
Assert.assertEquals(13, metrics.getBytesTransferred());
@@ -402,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(Mockito.<ByteBuffer>any());
- Mockito.verify(outbuf, Mockito.times(3)).write(Mockito.<ByteBuffer>any());
+ Mockito.verify(channel, Mockito.times(5)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(outbuf, Mockito.times(3)).write(Matchers.<ByteBuffer>any());
Mockito.verify(outbuf, Mockito.times(3)).flush(channel);
Assert.assertEquals(18, metrics.getBytesTransferred());
@@ -427,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(Mockito.<ByteBuffer>any());
- Mockito.verify(outbuf, Mockito.times(3)).write(Mockito.<ByteBuffer>any());
+ Mockito.verify(channel, Mockito.times(4)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(outbuf, Mockito.times(3)).write(Matchers.<ByteBuffer>any());
Mockito.verify(outbuf, Mockito.times(2)).flush(channel);
Assert.assertEquals(18, metrics.getBytesTransferred());
@@ -454,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(Mockito.<ByteBuffer>any());
- Mockito.verify(outbuf, Mockito.times(5)).write(Mockito.<ByteBuffer>any());
+ Mockito.verify(channel, Mockito.times(4)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(outbuf, Mockito.times(5)).write(Matchers.<ByteBuffer>any());
Mockito.verify(outbuf, Mockito.times(2)).flush(channel);
Assert.assertEquals(21, metrics.getBytesTransferred());
@@ -476,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(Mockito.<ByteBuffer>any());
- Mockito.verify(outbuf, Mockito.times(3)).write(Mockito.<ByteBuffer>any());
+ Mockito.verify(channel, Mockito.times(1)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(outbuf, Mockito.times(3)).write(Matchers.<ByteBuffer>any());
Mockito.verify(outbuf, Mockito.times(1)).flush(channel);
Assert.assertEquals(8, metrics.getBytesTransferred());
@@ -499,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(Mockito.<ByteBuffer>any());
- Mockito.verify(outbuf, Mockito.times(1)).write(Mockito.<ByteBuffer>any());
+ Mockito.verify(channel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(outbuf, Mockito.times(1)).write(Matchers.<ByteBuffer>any());
Mockito.verify(outbuf, Mockito.times(1)).flush(channel);
Assert.assertEquals(21, metrics.getBytesTransferred());
@@ -529,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(Mockito.<ByteBuffer>any());
- Mockito.verify(outbuf, Mockito.times(6)).write(Mockito.<ByteBuffer>any());
+ Mockito.verify(channel, Mockito.times(5)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(outbuf, Mockito.times(6)).write(Matchers.<ByteBuffer>any());
Mockito.verify(outbuf, Mockito.times(4)).flush(channel);
Assert.assertEquals(8, metrics.getBytesTransferred());
@@ -554,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(Mockito.<ByteBuffer>any());
- Mockito.verify(outbuf, Mockito.times(3)).write(Mockito.<ByteBuffer>any());
+ Mockito.verify(channel, Mockito.times(3)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(outbuf, Mockito.times(3)).write(Matchers.<ByteBuffer>any());
Mockito.verify(outbuf, Mockito.times(1)).flush(channel);
Assert.assertEquals(8, metrics.getBytesTransferred());
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/4e99c599/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestLengthDelimitedEncoder.java
----------------------------------------------------------------------
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 ca83ee4..71e0515 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,6 +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.Mockito;
/**
@@ -370,8 +371,8 @@ public class TestLengthDelimitedEncoder {
100, 0);
Assert.assertEquals(5, encoder.write(CodecTestUtils.wrap("stuff")));
- Mockito.verify(channel, Mockito.times(2)).write(Mockito.<ByteBuffer>any());
- Mockito.verify(outbuf, Mockito.never()).write(Mockito.<ByteBuffer>any());
+ Mockito.verify(channel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(outbuf, Mockito.never()).write(Matchers.<ByteBuffer>any());
Mockito.verify(outbuf, Mockito.times(1)).flush(channel);
Assert.assertEquals(13, metrics.getBytesTransferred());
@@ -393,8 +394,8 @@ public class TestLengthDelimitedEncoder {
100, 32);
Assert.assertEquals(5, encoder.write(CodecTestUtils.wrap("stuff")));
- Mockito.verify(channel, Mockito.never()).write(Mockito.<ByteBuffer>any());
- Mockito.verify(outbuf, Mockito.times(1)).write(Mockito.<ByteBuffer>any());
+ Mockito.verify(channel, Mockito.never()).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(outbuf, Mockito.times(1)).write(Matchers.<ByteBuffer>any());
Mockito.verify(outbuf, Mockito.never()).flush(channel);
Assert.assertEquals(0, metrics.getBytesTransferred());
@@ -417,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(Mockito.<ByteBuffer>any());
- Mockito.verify(outbuf, Mockito.times(3)).write(Mockito.<ByteBuffer>any());
+ Mockito.verify(channel, Mockito.never()).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(outbuf, Mockito.times(3)).write(Matchers.<ByteBuffer>any());
Mockito.verify(outbuf, Mockito.never()).flush(channel);
Assert.assertEquals(0, metrics.getBytesTransferred());
@@ -441,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(Mockito.<ByteBuffer>any());
- Mockito.verify(outbuf, Mockito.times(3)).write(Mockito.<ByteBuffer>any());
+ Mockito.verify(channel, Mockito.never()).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(outbuf, Mockito.times(3)).write(Matchers.<ByteBuffer>any());
Mockito.verify(outbuf, Mockito.never()).flush(channel);
Assert.assertEquals(0, metrics.getBytesTransferred());
@@ -464,8 +465,8 @@ public class TestLengthDelimitedEncoder {
100, 2);
Assert.assertEquals(5, encoder.write(CodecTestUtils.wrap("stuff")));
- Mockito.verify(channel, Mockito.times(2)).write(Mockito.<ByteBuffer>any());
- Mockito.verify(outbuf, Mockito.never()).write(Mockito.<ByteBuffer>any());
+ Mockito.verify(channel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(outbuf, Mockito.never()).write(Matchers.<ByteBuffer>any());
Mockito.verify(outbuf, Mockito.times(1)).flush(channel);
Assert.assertEquals(13, metrics.getBytesTransferred());
@@ -489,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(Mockito.<ByteBuffer>any());
- Mockito.verify(outbuf, Mockito.times(3)).write(Mockito.<ByteBuffer>any());
+ Mockito.verify(channel, Mockito.times(5)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(outbuf, Mockito.times(3)).write(Matchers.<ByteBuffer>any());
Mockito.verify(outbuf, Mockito.times(3)).flush(channel);
Assert.assertEquals(18, metrics.getBytesTransferred());
@@ -515,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(Mockito.<ByteBuffer>any());
- Mockito.verify(outbuf, Mockito.times(3)).write(Mockito.<ByteBuffer>any());
+ Mockito.verify(channel, Mockito.times(4)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(outbuf, Mockito.times(3)).write(Matchers.<ByteBuffer>any());
Mockito.verify(outbuf, Mockito.times(2)).flush(channel);
Assert.assertEquals(18, metrics.getBytesTransferred());
@@ -543,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(Mockito.<ByteBuffer>any());
- Mockito.verify(outbuf, Mockito.times(5)).write(Mockito.<ByteBuffer>any());
+ Mockito.verify(channel, Mockito.times(4)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(outbuf, Mockito.times(5)).write(Matchers.<ByteBuffer>any());
Mockito.verify(outbuf, Mockito.times(2)).flush(channel);
Assert.assertEquals(21, metrics.getBytesTransferred());
@@ -566,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(Mockito.<ByteBuffer>any());
- Mockito.verify(outbuf, Mockito.times(3)).write(Mockito.<ByteBuffer>any());
+ Mockito.verify(channel, Mockito.times(1)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(outbuf, Mockito.times(3)).write(Matchers.<ByteBuffer>any());
Mockito.verify(outbuf, Mockito.times(1)).flush(channel);
Assert.assertEquals(8, metrics.getBytesTransferred());
@@ -590,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(Mockito.<ByteBuffer>any());
- Mockito.verify(outbuf, Mockito.times(1)).write(Mockito.<ByteBuffer>any());
+ Mockito.verify(channel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(outbuf, Mockito.times(1)).write(Matchers.<ByteBuffer>any());
Mockito.verify(outbuf, Mockito.times(1)).flush(channel);
Assert.assertEquals(21, metrics.getBytesTransferred());
@@ -621,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(Mockito.<ByteBuffer>any());
- Mockito.verify(outbuf, Mockito.times(6)).write(Mockito.<ByteBuffer>any());
+ Mockito.verify(channel, Mockito.times(5)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(outbuf, Mockito.times(6)).write(Matchers.<ByteBuffer>any());
Mockito.verify(outbuf, Mockito.times(4)).flush(channel);
Assert.assertEquals(8, metrics.getBytesTransferred());
@@ -647,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(Mockito.<ByteBuffer>any());
- Mockito.verify(outbuf, Mockito.times(3)).write(Mockito.<ByteBuffer>any());
+ Mockito.verify(channel, Mockito.times(3)).write(Matchers.<ByteBuffer>any());
+ Mockito.verify(outbuf, Mockito.times(3)).write(Matchers.<ByteBuffer>any());
Mockito.verify(outbuf, Mockito.times(1)).flush(channel);
Assert.assertEquals(8, metrics.getBytesTransferred());
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/4e99c599/httpcore-nio/src/test/java/org/apache/http/impl/nio/pool/TestBasicNIOConnPool.java
----------------------------------------------------------------------
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 7b58374..78f9cdc 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,6 +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.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
@@ -113,10 +114,10 @@ public class TestBasicNIOConnPool {
Mockito.when(sessionRequest.getSession()).thenReturn(session);
Mockito.when(sessionRequest.getAttachment()).thenReturn(host);
Mockito.when(reactor.connect(
- Mockito.any(SocketAddress.class),
- Mockito.any(SocketAddress.class),
- Mockito.eq(host),
- Mockito.any(SessionRequestCallback.class))).
+ Matchers.any(SocketAddress.class),
+ Matchers.any(SocketAddress.class),
+ Matchers.eq(host),
+ Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest);
Mockito.when(session.getSocketTimeout()).thenReturn(999);
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/4e99c599/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java
----------------------------------------------------------------------
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 1cb357e..65d1f44 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
@@ -47,6 +47,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.Mockito;
public class TestNIOConnPool {
@@ -173,9 +174,9 @@ public class TestNIOConnPool {
Mockito.when(sessionRequest.getSession()).thenReturn(iosession);
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect(
- Mockito.any(SocketAddress.class),
- Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class))).
+ Matchers.any(SocketAddress.class),
+ Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.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);
@@ -206,9 +207,9 @@ public class TestNIOConnPool {
Mockito.when(sessionRequest.getException()).thenReturn(new IOException());
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect(
- Mockito.any(SocketAddress.class),
- Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class))).
+ Matchers.any(SocketAddress.class),
+ Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest);
final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 10);
final Future<LocalPoolEntry> future = pool.lease("somehost", null);
@@ -243,9 +244,9 @@ public class TestNIOConnPool {
Mockito.when(sessionRequest.getSession()).thenReturn(iosession);
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect(
- Mockito.any(SocketAddress.class),
- Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class))).
+ Matchers.any(SocketAddress.class),
+ Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest);
Mockito.when(ioreactor.getStatus()).thenReturn(IOReactorStatus.ACTIVE);
final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 10);
@@ -280,9 +281,9 @@ public class TestNIOConnPool {
Mockito.when(sessionRequest.getSession()).thenReturn(iosession);
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect(
- Mockito.any(SocketAddress.class),
- Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class))).
+ Matchers.any(SocketAddress.class),
+ Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest);
final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 10);
final Future<LocalPoolEntry> future = pool.lease("somehost", null);
@@ -345,14 +346,14 @@ public class TestNIOConnPool {
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect(
- Mockito.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class))).
+ Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1);
Mockito.when(ioreactor.connect(
- Mockito.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
- Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class))).
+ Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
+ Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest2);
final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 10);
@@ -419,14 +420,14 @@ public class TestNIOConnPool {
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect(
- Mockito.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class))).
+ Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1);
Mockito.when(ioreactor.connect(
- Mockito.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
- Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class))).
+ Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
+ Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest2);
final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 10);
@@ -478,8 +479,8 @@ public class TestNIOConnPool {
Assert.assertFalse(future9.isDone());
Mockito.verify(ioreactor, Mockito.times(3)).connect(
- Mockito.any(SocketAddress.class), Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class));
+ Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class));
pool.release(entry4, true);
pool.release(entry5, false);
@@ -490,8 +491,8 @@ public class TestNIOConnPool {
Assert.assertTrue(future9.isDone());
Mockito.verify(ioreactor, Mockito.times(4)).connect(
- Mockito.any(SocketAddress.class), Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class));
+ Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class));
}
@Test
@@ -518,14 +519,14 @@ public class TestNIOConnPool {
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect(
- Mockito.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class))).
+ Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1, sessionRequest2, sessionRequest1);
Mockito.when(ioreactor.connect(
- Mockito.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
- Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class))).
+ Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
+ Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest3, sessionRequest4, sessionRequest3);
final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 10);
@@ -539,14 +540,14 @@ public class TestNIOConnPool {
final Future<LocalPoolEntry> future4 = pool.lease("otherhost", null);
Mockito.verify(ioreactor, Mockito.times(2)).connect(
- Mockito.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class));
+ Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class));
Mockito.verify(ioreactor, Mockito.never()).connect(
- Mockito.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
- Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class));
+ Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
+ Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class));
pool.requestCompleted(sessionRequest1);
pool.requestCompleted(sessionRequest2);
@@ -570,14 +571,14 @@ public class TestNIOConnPool {
pool.release(entry2, true);
Mockito.verify(ioreactor, Mockito.times(2)).connect(
- Mockito.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class));
+ Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class));
Mockito.verify(ioreactor, Mockito.times(2)).connect(
- Mockito.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
- Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class));
+ Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
+ Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class));
pool.requestCompleted(sessionRequest3);
pool.requestCompleted(sessionRequest4);
@@ -598,27 +599,27 @@ public class TestNIOConnPool {
final Future<LocalPoolEntry> future6 = pool.lease("otherhost", null);
Mockito.verify(ioreactor, Mockito.times(2)).connect(
- Mockito.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class));
+ Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class));
Mockito.verify(ioreactor, Mockito.times(2)).connect(
- Mockito.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
- Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class));
+ Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
+ Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class));
pool.release(entry3, true);
pool.release(entry4, true);
Mockito.verify(ioreactor, Mockito.times(3)).connect(
- Mockito.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class));
+ Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class));
Mockito.verify(ioreactor, Mockito.times(2)).connect(
- Mockito.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
- Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class));
+ Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
+ Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class));
pool.requestCompleted(sessionRequest1);
@@ -638,14 +639,14 @@ public class TestNIOConnPool {
pool.release(entry6, true);
Mockito.verify(ioreactor, Mockito.times(3)).connect(
- Mockito.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class));
+ Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class));
Mockito.verify(ioreactor, Mockito.times(2)).connect(
- Mockito.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
- Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class));
+ Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
+ Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class));
totals = pool.getTotalStats();
Assert.assertEquals(2, totals.getAvailable());
@@ -672,9 +673,9 @@ public class TestNIOConnPool {
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect(
- Mockito.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class))).
+ Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1, sessionRequest2, sessionRequest3);
final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 10);
@@ -685,9 +686,9 @@ public class TestNIOConnPool {
final Future<LocalPoolEntry> future2 = pool.lease("somehost", null);
Mockito.verify(ioreactor, Mockito.times(2)).connect(
- Mockito.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class));
+ Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class));
pool.requestCompleted(sessionRequest1);
pool.requestCompleted(sessionRequest2);
@@ -720,9 +721,9 @@ public class TestNIOConnPool {
Assert.assertNotNull(entry4);
Mockito.verify(ioreactor, Mockito.times(2)).connect(
- Mockito.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class));
+ Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class));
pool.release(entry3, true);
pool.release(entry4, true);
@@ -737,9 +738,9 @@ public class TestNIOConnPool {
Assert.assertFalse(future5.isDone());
Mockito.verify(ioreactor, Mockito.times(3)).connect(
- Mockito.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class));
+ Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class));
Mockito.verify(iosession2).close();
Mockito.verify(iosession1, Mockito.never()).close();
@@ -760,9 +761,9 @@ public class TestNIOConnPool {
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect(
- Mockito.eq(InetSocketAddress.createUnresolved("somehost", 80)),
- Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class))).
+ Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
+ Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1);
final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 2);
@@ -770,8 +771,8 @@ public class TestNIOConnPool {
final Future<LocalPoolEntry> future1 = pool.lease("somehost", null);
Mockito.verify(ioreactor, Mockito.times(1)).connect(
- Mockito.any(SocketAddress.class), Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class));
+ Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class));
pool.requestCompleted(sessionRequest1);
@@ -790,8 +791,8 @@ public class TestNIOConnPool {
Mockito.verify(iosession1).close();
Mockito.verify(ioreactor, Mockito.times(2)).connect(
- Mockito.any(SocketAddress.class), Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class));
+ Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class));
final PoolStats totals = pool.getTotalStats();
Assert.assertEquals(0, totals.getAvailable());
@@ -819,8 +820,8 @@ public class TestNIOConnPool {
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect(
- Mockito.any(SocketAddress.class), Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class))).
+ Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1, sessionRequest2);
final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 2);
@@ -875,8 +876,8 @@ public class TestNIOConnPool {
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect(
- Mockito.any(SocketAddress.class), Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class))).
+ Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1, sessionRequest2);
final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 2);
@@ -940,8 +941,8 @@ public class TestNIOConnPool {
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect(
- Mockito.any(SocketAddress.class), Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class))).
+ Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1);
final LocalSessionPool pool = new LocalSessionPool(ioreactor, 1, 1);
@@ -1037,8 +1038,8 @@ public class TestNIOConnPool {
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect(
- Mockito.any(SocketAddress.class), Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class))).
+ Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1);
Mockito.when(ioreactor.getStatus()).thenReturn(IOReactorStatus.ACTIVE);
@@ -1071,8 +1072,8 @@ public class TestNIOConnPool {
final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
Mockito.when(ioreactor.connect(
- Mockito.any(SocketAddress.class), Mockito.any(SocketAddress.class),
- Mockito.any(), Mockito.any(SessionRequestCallback.class))).
+ Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
+ Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1);
Mockito.when(ioreactor.getStatus()).thenReturn(IOReactorStatus.ACTIVE);
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/4e99c599/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncRequestHandler.java
----------------------------------------------------------------------
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 866d989..3b44478 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,6 +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.Mockito;
public class TestBasicAsyncRequestHandler {
@@ -89,7 +90,7 @@ public class TestBasicAsyncRequestHandler {
this.asyncRequestHandler.handle(this.request, this.httpexchange, this.context);
Mockito.verify(this.requestHandler).handle(
- Mockito.eq(this.request), Mockito.eq(this.response), Mockito.eq(this.context));
+ Matchers.eq(this.request), Matchers.eq(this.response), Matchers.eq(this.context));
Mockito.verify(this.httpexchange).submitResponse();
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/4e99c599/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequestExecutor.java
----------------------------------------------------------------------
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 6bc3314..3568fd0 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,6 +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.Mockito;
public class TestHttpAsyncRequestExecutor {
@@ -130,7 +131,7 @@ public class TestHttpAsyncRequestExecutor {
this.protocolHandler.closed(this.conn);
- Mockito.verify(this.exchangeHandler).failed(Mockito.any(ConnectionClosedException.class));
+ Mockito.verify(this.exchangeHandler).failed(Matchers.any(ConnectionClosedException.class));
}
@Test
@@ -194,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(Mockito.<HttpRequest>any());
+ Mockito.verify(this.conn, Mockito.never()).submitRequest(Matchers.<HttpRequest>any());
}
@Test
@@ -611,7 +612,7 @@ public class TestHttpAsyncRequestExecutor {
Assert.assertFalse(state.isValid());
Mockito.verify(this.conn).close();
- Mockito.verify(this.exchangeHandler).failed(Mockito.any(ConnectionClosedException.class));
+ Mockito.verify(this.exchangeHandler).failed(Matchers.any(ConnectionClosedException.class));
}
@Test
@@ -670,10 +671,10 @@ public class TestHttpAsyncRequestExecutor {
Assert.assertEquals(MessageState.BODY_STREAM, state.getRequestState());
Assert.assertFalse(state.isValid());
- Mockito.verify(this.exchangeHandler).failed(Mockito.any(SocketTimeoutException.class));
+ Mockito.verify(this.exchangeHandler).failed(Matchers.any(SocketTimeoutException.class));
Mockito.verify(this.exchangeHandler).close();
Mockito.verify(this.conn).close();
- Mockito.verify(this.conn, Mockito.never()).setSocketTimeout(Mockito.anyInt());
+ Mockito.verify(this.conn, Mockito.never()).setSocketTimeout(Matchers.anyInt());
}
@Test
@@ -688,7 +689,7 @@ public class TestHttpAsyncRequestExecutor {
Assert.assertEquals(MessageState.BODY_STREAM, state.getRequestState());
Assert.assertFalse(state.isValid());
- Mockito.verify(this.exchangeHandler).failed(Mockito.any(SocketTimeoutException.class));
+ Mockito.verify(this.exchangeHandler).failed(Matchers.any(SocketTimeoutException.class));
Mockito.verify(this.exchangeHandler).close();
Mockito.verify(this.conn).close();
Mockito.verify(this.conn).setSocketTimeout(250);
@@ -706,7 +707,7 @@ public class TestHttpAsyncRequestExecutor {
Assert.assertEquals(MessageState.BODY_STREAM, state.getRequestState());
Assert.assertFalse(state.isValid());
- Mockito.verify(this.exchangeHandler).failed(Mockito.any(SocketTimeoutException.class));
+ Mockito.verify(this.exchangeHandler).failed(Matchers.any(SocketTimeoutException.class));
Mockito.verify(this.exchangeHandler).close();
Mockito.verify(this.conn).shutdown();
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/4e99c599/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequester.java
----------------------------------------------------------------------
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 55a4f06..93b079d 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,6 +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.Mockito;
public class TestHttpAsyncRequester {
@@ -174,8 +175,8 @@ public class TestHttpAsyncRequester {
this.responseConsumer,
this.conn, this.exchangeContext, null);
Assert.assertNotNull(future);
- Mockito.verify(this.requestProducer).failed(Mockito.any(ConnectionClosedException.class));
- Mockito.verify(this.responseConsumer).failed(Mockito.any(ConnectionClosedException.class));
+ Mockito.verify(this.requestProducer).failed(Matchers.any(ConnectionClosedException.class));
+ Mockito.verify(this.responseConsumer).failed(Matchers.any(ConnectionClosedException.class));
Mockito.verify(this.requestProducer, Mockito.atLeastOnce()).close();
Mockito.verify(this.responseConsumer, Mockito.atLeastOnce()).close();
Assert.assertTrue(future.isDone());
@@ -203,7 +204,7 @@ public class TestHttpAsyncRequester {
Assert.assertNotNull(future);
final ArgumentCaptor<FutureCallback> argCaptor = ArgumentCaptor.forClass(FutureCallback.class);
Mockito.verify(this.connPool).lease(
- Mockito.eq(host), Mockito.isNull(), argCaptor.capture());
+ Matchers.eq(host), Matchers.isNull(), argCaptor.capture());
final ConnRequestCallback connRequestCallback = (ConnRequestCallback) argCaptor.getValue();
final Exception oppsie = new Exception();
@@ -227,7 +228,7 @@ public class TestHttpAsyncRequester {
Assert.assertNotNull(future);
final ArgumentCaptor<FutureCallback> argCaptor = ArgumentCaptor.forClass(FutureCallback.class);
Mockito.verify(this.connPool).lease(
- Mockito.eq(host), Mockito.isNull(), argCaptor.capture());
+ Matchers.eq(host), Matchers.isNull(), argCaptor.capture());
final ConnRequestCallback connRequestCallback = (ConnRequestCallback) argCaptor.getValue();
connRequestCallback.cancelled();
@@ -250,7 +251,7 @@ public class TestHttpAsyncRequester {
Assert.assertNotNull(future);
final ArgumentCaptor<FutureCallback> argCaptor = ArgumentCaptor.forClass(FutureCallback.class);
Mockito.verify(this.connPool).lease(
- Mockito.eq(host), Mockito.isNull(), argCaptor.capture());
+ Matchers.eq(host), Matchers.isNull(), argCaptor.capture());
final ConnRequestCallback connRequestCallback = (ConnRequestCallback) argCaptor.getValue();
future.cancel(true);
@@ -275,7 +276,7 @@ public class TestHttpAsyncRequester {
Assert.assertNotNull(future);
final ArgumentCaptor<FutureCallback> argCaptor = ArgumentCaptor.forClass(FutureCallback.class);
Mockito.verify(this.connPool).lease(
- Mockito.eq(host), Mockito.isNull(), argCaptor.capture());
+ Matchers.eq(host), Matchers.isNull(), argCaptor.capture());
final ConnRequestCallback connRequestCallback = (ConnRequestCallback) argCaptor.getValue();
final BasicNIOPoolEntry entry = new BasicNIOPoolEntry("id", host, this.conn);
@@ -308,7 +309,7 @@ public class TestHttpAsyncRequester {
Assert.assertNotNull(future);
final ArgumentCaptor<FutureCallback> argCaptor = ArgumentCaptor.forClass(FutureCallback.class);
Mockito.verify(this.connPool).lease(
- Mockito.eq(host), Mockito.isNull(), argCaptor.capture());
+ Matchers.eq(host), Matchers.isNull(), argCaptor.capture());
final ConnRequestCallback connRequestCallback = (ConnRequestCallback) argCaptor.getValue();
final BasicNIOPoolEntry entry = new BasicNIOPoolEntry("id", host, this.conn);
@@ -341,7 +342,7 @@ public class TestHttpAsyncRequester {
Assert.assertNotNull(future);
final ArgumentCaptor<FutureCallback> argCaptor = ArgumentCaptor.forClass(FutureCallback.class);
Mockito.verify(this.connPool).lease(
- Mockito.eq(host), Mockito.isNull(), argCaptor.capture());
+ Matchers.eq(host), Matchers.isNull(), argCaptor.capture());
final ConnRequestCallback connRequestCallback = (ConnRequestCallback) argCaptor.getValue();
final BasicNIOPoolEntry entry = new BasicNIOPoolEntry("id", host, this.conn);