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 2015/08/27 00:17:47 UTC

svn commit: r1698024 - in /httpcomponents/httpasyncclient/trunk/httpasyncclient/src/test/java/org/apache/http: impl/nio/conn/TestPoolingHttpClientAsyncConnectionManager.java nio/client/methods/TestAsyncConsumers.java

Author: ggregory
Date: Wed Aug 26 22:17:47 2015
New Revision: 1698024

URL: http://svn.apache.org/r1698024
Log:
Static methods should be accessed directly.

Modified:
    httpcomponents/httpasyncclient/trunk/httpasyncclient/src/test/java/org/apache/http/impl/nio/conn/TestPoolingHttpClientAsyncConnectionManager.java
    httpcomponents/httpasyncclient/trunk/httpasyncclient/src/test/java/org/apache/http/nio/client/methods/TestAsyncConsumers.java

Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/test/java/org/apache/http/impl/nio/conn/TestPoolingHttpClientAsyncConnectionManager.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/test/java/org/apache/http/impl/nio/conn/TestPoolingHttpClientAsyncConnectionManager.java?rev=1698024&r1=1698023&r2=1698024&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/test/java/org/apache/http/impl/nio/conn/TestPoolingHttpClientAsyncConnectionManager.java (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/test/java/org/apache/http/impl/nio/conn/TestPoolingHttpClientAsyncConnectionManager.java Wed Aug 26 22:17:47 2015
@@ -60,6 +60,7 @@ import org.junit.Before;
 import org.junit.Test;
 import org.mockito.ArgumentCaptor;
 import org.mockito.Captor;
+import org.mockito.Matchers;
 import org.mockito.Mock;
 import org.mockito.Mockito;
 import org.mockito.MockitoAnnotations;
@@ -130,11 +131,11 @@ public class TestPoolingHttpClientAsyncC
         Assert.assertNotNull(future);
 
         Mockito.verify(pool).lease(
-                Mockito.same(route),
-                Mockito.eq("some state"),
-                Mockito.eq(1000L),
-                Mockito.eq(2000L),
-                Mockito.eq(TimeUnit.MILLISECONDS),
+                Matchers.same(route),
+                Matchers.eq("some state"),
+                Matchers.eq(1000L),
+                Matchers.eq(2000L),
+                Matchers.eq(TimeUnit.MILLISECONDS),
                 poolEntryCallbackCaptor.capture());
         final FutureCallback<CPoolEntry> callaback = poolEntryCallbackCaptor.getValue();
         final Log log = Mockito.mock(Log.class);
@@ -144,7 +145,7 @@ public class TestPoolingHttpClientAsyncC
 
         Assert.assertTrue(future.isDone());
         final NHttpClientConnection managedConn = future.get();
-        Mockito.verify(connCallback).completed(Mockito.<NHttpClientConnection>any());
+        Mockito.verify(connCallback).completed(Matchers.<NHttpClientConnection>any());
 
         Mockito.when(conn.isOpen()).thenReturn(Boolean.TRUE);
         connman.releaseConnection(managedConn, "new state", 5, TimeUnit.SECONDS);
@@ -166,11 +167,11 @@ public class TestPoolingHttpClientAsyncC
         Assert.assertNotNull(future);
 
         Mockito.verify(pool).lease(
-                Mockito.same(route),
-                Mockito.eq("some state"),
-                Mockito.eq(1000L),
-                Mockito.eq(2000L),
-                Mockito.eq(TimeUnit.MILLISECONDS),
+                Matchers.same(route),
+                Matchers.eq("some state"),
+                Matchers.eq(1000L),
+                Matchers.eq(2000L),
+                Matchers.eq(TimeUnit.MILLISECONDS),
                 poolEntryCallbackCaptor.capture());
         final FutureCallback<CPoolEntry> callaback = poolEntryCallbackCaptor.getValue();
         final Log log = Mockito.mock(Log.class);
@@ -179,7 +180,7 @@ public class TestPoolingHttpClientAsyncC
 
         Assert.assertTrue(future.isDone());
         final NHttpClientConnection managedConn = future.get();
-        Mockito.verify(connCallback).completed(Mockito.<NHttpClientConnection>any());
+        Mockito.verify(connCallback).completed(Matchers.<NHttpClientConnection>any());
 
         Mockito.when(conn.isOpen()).thenReturn(Boolean.TRUE);
         connman.releaseConnection(managedConn, "new state", 5, TimeUnit.SECONDS);
@@ -197,11 +198,11 @@ public class TestPoolingHttpClientAsyncC
         future.cancel(true);
 
         Mockito.verify(pool).lease(
-                Mockito.same(route),
-                Mockito.eq("some state"),
-                Mockito.eq(1000L),
-                Mockito.eq(2000L),
-                Mockito.eq(TimeUnit.MILLISECONDS),
+                Matchers.same(route),
+                Matchers.eq("some state"),
+                Matchers.eq(1000L),
+                Matchers.eq(2000L),
+                Matchers.eq(TimeUnit.MILLISECONDS),
                 poolEntryCallbackCaptor.capture());
         final FutureCallback<CPoolEntry> callaback = poolEntryCallbackCaptor.getValue();
         final Log log = Mockito.mock(Log.class);
@@ -221,11 +222,11 @@ public class TestPoolingHttpClientAsyncC
         Assert.assertNotNull(future);
 
         Mockito.verify(pool).lease(
-                Mockito.same(route),
-                Mockito.eq("some state"),
-                Mockito.eq(1000L),
-                Mockito.eq(2000L),
-                Mockito.eq(TimeUnit.MILLISECONDS),
+                Matchers.same(route),
+                Matchers.eq("some state"),
+                Matchers.eq(1000L),
+                Matchers.eq(2000L),
+                Matchers.eq(TimeUnit.MILLISECONDS),
                 poolEntryCallbackCaptor.capture());
         final FutureCallback<CPoolEntry> callaback = poolEntryCallbackCaptor.getValue();
         callaback.failed(new Exception());
@@ -243,11 +244,11 @@ public class TestPoolingHttpClientAsyncC
         Assert.assertNotNull(future);
 
         Mockito.verify(pool).lease(
-                Mockito.same(route),
-                Mockito.eq("some state"),
-                Mockito.eq(1000L),
-                Mockito.eq(2000L),
-                Mockito.eq(TimeUnit.MILLISECONDS),
+                Matchers.same(route),
+                Matchers.eq("some state"),
+                Matchers.eq(1000L),
+                Matchers.eq(2000L),
+                Matchers.eq(TimeUnit.MILLISECONDS),
                 poolEntryCallbackCaptor.capture());
         final FutureCallback<CPoolEntry> callaback = poolEntryCallbackCaptor.getValue();
         callaback.cancelled();
@@ -458,9 +459,9 @@ public class TestPoolingHttpClientAsyncC
         final HttpRoute route = new HttpRoute(new HttpHost("somehost", 80));
         internalConnFactory.create(route, iosession);
 
-        Mockito.verify(sslStrategy, Mockito.never()).upgrade(Mockito.eq(new HttpHost("somehost", 80)),
-                Mockito.<IOSession>any());
-        Mockito.verify(connFactory).create(Mockito.same(iosession), Mockito.<ConnectionConfig>any());
+        Mockito.verify(sslStrategy, Mockito.never()).upgrade(Matchers.eq(new HttpHost("somehost", 80)),
+                Matchers.<IOSession>any());
+        Mockito.verify(connFactory).create(Matchers.same(iosession), Matchers.<ConnectionConfig>any());
     }
 
     @Test

Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/test/java/org/apache/http/nio/client/methods/TestAsyncConsumers.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/test/java/org/apache/http/nio/client/methods/TestAsyncConsumers.java?rev=1698024&r1=1698023&r2=1698024&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/test/java/org/apache/http/nio/client/methods/TestAsyncConsumers.java (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/test/java/org/apache/http/nio/client/methods/TestAsyncConsumers.java Wed Aug 26 22:17:47 2015
@@ -48,6 +48,7 @@ import org.apache.http.protocol.HttpCont
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
+import org.mockito.Matchers;
 import org.mockito.Mockito;
 
 public class TestAsyncConsumers extends HttpAsyncTestBase {
@@ -206,7 +207,7 @@ public class TestAsyncConsumers extends
         final Future<String> future = this.httpclient.execute(httppost, consumer, null);
         final String result = future.get();
         Assert.assertEquals(s, result);
-        Mockito.verify(consumer).buildResult(Mockito.any(HttpContext.class));
+        Mockito.verify(consumer).buildResult(Matchers.any(HttpContext.class));
         Mockito.verify(consumer).releaseResources();
     }
 
@@ -218,7 +219,7 @@ public class TestAsyncConsumers extends
                 ContentType.create("text/plain", Consts.ASCII));
         final AsyncCharConsumer<String> consumer = Mockito.spy(new BufferingCharConsumer());
         Mockito.doThrow(new IOException("Kaboom")).when(consumer).onCharReceived(
-                Mockito.any(CharBuffer.class), Mockito.any(IOControl.class));
+                Matchers.any(CharBuffer.class), Matchers.any(IOControl.class));
 
         final Future<String> future = this.httpclient.execute(httppost, consumer, null);
         try {
@@ -240,7 +241,7 @@ public class TestAsyncConsumers extends
                 target.toURI() + "/echo/stuff", "stuff",
                 ContentType.create("text/plain", Consts.ASCII));
         final BufferingCharConsumer consumer = Mockito.spy(new BufferingCharConsumer());
-        Mockito.doThrow(new HttpException("Kaboom")).when(consumer).buildResult(Mockito.any(HttpContext.class));
+        Mockito.doThrow(new HttpException("Kaboom")).when(consumer).buildResult(Matchers.any(HttpContext.class));
 
         final Future<String> future = this.httpclient.execute(httppost, consumer, null);
         try {