hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1698029 [2/2] - in /httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http: impl/nio/ impl/nio/codecs/ impl/nio/pool/ nio/pool/ nio/protocol/
Date Wed, 26 Aug 2015 22:26:19 GMT
Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncService.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncService.java?rev=1698029&r1=1698028&r2=1698029&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncService.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncService.java
Wed Aug 26 22:26:18 2015
@@ -46,7 +46,6 @@ import org.apache.http.message.BasicHttp
 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;
@@ -65,6 +64,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 +212,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 +245,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 +295,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 +309,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 +338,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 +352,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 +383,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 +397,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();
@@ -422,7 +422,7 @@ public class TestHttpAsyncService {
         request.setEntity(entity);
         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);
 
@@ -446,7 +446,7 @@ public class TestHttpAsyncService {
         request.setEntity(entity);
         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);
 
@@ -482,7 +482,7 @@ public class TestHttpAsyncService {
         request.setEntity(entity);
         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);
 
@@ -504,7 +504,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) {
@@ -532,7 +532,7 @@ public class TestHttpAsyncService {
         request.setEntity(entity);
         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);
 
@@ -555,8 +555,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
@@ -618,7 +618,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);
 
@@ -652,7 +652,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);
 
@@ -682,7 +682,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);
@@ -1038,7 +1038,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) {
@@ -1119,8 +1119,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);
@@ -1154,9 +1154,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)
@@ -1339,7 +1339,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();
     }
 
@@ -1363,7 +1363,7 @@ public class TestHttpAsyncService {
         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
@@ -1396,9 +1396,9 @@ public class TestHttpAsyncService {
         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();
     }
 



Mime
View raw message