hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r936527 - /httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestBasicHttpProcessor.java
Date Wed, 21 Apr 2010 21:50:44 GMT
Author: sebb
Date: Wed Apr 21 21:50:44 2010
New Revision: 936527

URL: http://svn.apache.org/viewvc?rev=936527&view=rev
Log:
Remove testMiddle - not useful
Tidy up other tests

Modified:
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestBasicHttpProcessor.java

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestBasicHttpProcessor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestBasicHttpProcessor.java?rev=936527&r1=936526&r2=936527&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestBasicHttpProcessor.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestBasicHttpProcessor.java
Wed Apr 21 21:50:44 2010
@@ -64,30 +64,20 @@ public class TestBasicHttpProcessor exte
         assertEquals(null, instance.getRequestInterceptor(0));
     }
 
-    public void testAddFirsRequestInterceptor() {
-        HttpRequestInterceptor itcp1 = new HttpRequestInterceptor() {
-            
-            public void process(
-                    HttpRequest request, 
-                    HttpContext context) throws HttpException, IOException {
-            }
-            
-        };
-        HttpRequestInterceptor itcp2 = new HttpRequestInterceptor() {
-            
-            public void process(
-                    HttpRequest request, 
-                    HttpContext context) throws HttpException, IOException {
-            }
-            
-        };
+    public void testAddFirstRequestInterceptor() {
+        HttpRequestInterceptor itcp1 = new TestHttpRequestInterceptorPlaceHolder();
+        HttpRequestInterceptor itcp2 = new TestHttpRequestInterceptorPlaceHolder();
         BasicHttpProcessor instance = new BasicHttpProcessor();
 
+        assertEquals(0, instance.getRequestInterceptorCount());
         instance.addRequestInterceptor(itcp1);
+        assertEquals(1, instance.getRequestInterceptorCount());
+        assertSame(itcp1, instance.getRequestInterceptor(0));
+
         instance.addRequestInterceptor(itcp2, 0);
-        int itcpCount = instance.getRequestInterceptorCount();
-        assertEquals(2, itcpCount);
-        assertEquals(itcp2, instance.getRequestInterceptor(0));
+        assertEquals(2, instance.getRequestInterceptorCount());
+        assertSame(itcp2, instance.getRequestInterceptor(0));
+        assertSame(itcp1, instance.getRequestInterceptor(1));
     }
 
     public void testAddTailRequestInterceptorNull() {
@@ -101,36 +91,19 @@ public class TestBasicHttpProcessor exte
     }
 
     public void testAddTailRequestInterceptor() {
-        HttpRequestInterceptor itcp1 = new HttpRequestInterceptor() {
-            
-            public void process(
-                    HttpRequest request, 
-                    HttpContext context) throws HttpException, IOException {
-            }
-            
-        };
-        HttpRequestInterceptor itcp2 = new HttpRequestInterceptor() {
-            
-            public void process(
-                    HttpRequest request, 
-                    HttpContext context) throws HttpException, IOException {
-            }
-            
-        };
+        HttpRequestInterceptor itcp1 = new TestHttpRequestInterceptorPlaceHolder();
+        HttpRequestInterceptor itcp2 = new TestHttpRequestInterceptorPlaceHolder();
         BasicHttpProcessor instance = new BasicHttpProcessor();
 
         instance.addRequestInterceptor(itcp1);
+        assertEquals(1, instance.getRequestInterceptorCount());
+        assertSame(itcp1, instance.getRequestInterceptor(0));
+
         instance.addRequestInterceptor(itcp2, 1);
         int itcpCount = instance.getRequestInterceptorCount();
         assertEquals(2, itcpCount);
-        assertEquals(itcp1, instance.getRequestInterceptor(0));
-        assertEquals(itcp2, instance.getRequestInterceptor(itcpCount - 1));
-    }
-
-    public void testAddRequestInterceptorMiddleIndex() {
-        HttpRequestInterceptor itcp1 = new TestHttpRequestInterceptorPlaceHolder();
-        BasicHttpProcessor instance = new BasicHttpProcessor();
-        instance.addRequestInterceptor(itcp1, 0);
+        assertSame(itcp1, instance.getRequestInterceptor(0));
+        assertSame(itcp2, instance.getRequestInterceptor(itcpCount - 1));
     }
 
     public void testClearByClass() {



Mime
View raw message