hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1100965 [3/9] - in /httpcomponents/httpcore/trunk: httpcore-nio/src/test/java/org/apache/http/ httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/ httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/ httpcore-nio/src/test/j...
Date Mon, 09 May 2011 11:27:00 GMT
Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestNIOSSLHttp.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestNIOSSLHttp.java?rev=1100965&r1=1100964&r2=1100965&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestNIOSSLHttp.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestNIOSSLHttp.java Mon May  9 11:26:57 2011
@@ -62,19 +62,14 @@ import org.apache.http.protocol.Response
 import org.apache.http.protocol.ResponseContent;
 import org.apache.http.protocol.ResponseDate;
 import org.apache.http.protocol.ResponseServer;
+import org.junit.Assert;
+import org.junit.Test;
 
 /**
  * HttpCore NIO SSL tests.
  */
 public class TestNIOSSLHttp extends HttpCoreNIOSSLTestBase {
 
-    // ------------------------------------------------------------ Constructor
-    public TestNIOSSLHttp(String testName) {
-        super(testName);
-    }
-
-    // ------------------------------------------------------- TestCase Methods
-
     private void executeStandardTest(
             final NHttpRequestHandler requestHandler,
             final NHttpRequestExecutionHandler requestExecutionHandler) throws Exception {
@@ -130,7 +125,7 @@ public class TestNIOSSLHttp extends Http
         endpoint.waitFor();
         InetSocketAddress serverAddress = (InetSocketAddress) endpoint.getAddress();
 
-        assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
+        Assert.assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
 
         Queue<SessionRequest> connRequests = new LinkedList<SessionRequest>();
         for (int i = 0; i < connNo; i++) {
@@ -146,19 +141,19 @@ public class TestNIOSSLHttp extends Http
             if (sessionRequest.getException() != null) {
                 throw sessionRequest.getException();
             }
-            assertNotNull(sessionRequest.getSession());
+            Assert.assertNotNull(sessionRequest.getSession());
         }
 
-        assertEquals("Test client status", IOReactorStatus.ACTIVE, this.client.getStatus());
+        Assert.assertEquals("Test client status", IOReactorStatus.ACTIVE, this.client.getStatus());
 
         for (int i = 0; i < jobs.length; i++) {
             Job testjob = jobs[i];
             testjob.waitFor();
             if (testjob.isSuccessful()) {
-                assertEquals(HttpStatus.SC_OK, testjob.getStatusCode());
-                assertEquals(testjob.getExpected(), testjob.getResult());
+                Assert.assertEquals(HttpStatus.SC_OK, testjob.getStatusCode());
+                Assert.assertEquals(testjob.getExpected(), testjob.getResult());
             } else {
-                fail(testjob.getFailureMessage());
+                Assert.fail(testjob.getFailureMessage());
             }
         }
     }
@@ -167,6 +162,7 @@ public class TestNIOSSLHttp extends Http
      * This test case executes a series of simple (non-pipelined) GET requests
      * over multiple connections.
      */
+    @Test
     public void testHttpGets() throws Exception {
         NHttpRequestExecutionHandler requestExecutionHandler = new RequestExecutionHandler() {
 
@@ -184,6 +180,7 @@ public class TestNIOSSLHttp extends Http
      * This test case executes a series of simple (non-pipelined) POST requests
      * with content length delimited content over multiple connections.
      */
+    @Test
     public void testHttpPostsWithContentLength() throws Exception {
         NHttpRequestExecutionHandler requestExecutionHandler = new RequestExecutionHandler() {
 
@@ -209,6 +206,7 @@ public class TestNIOSSLHttp extends Http
      * This test case executes a series of simple (non-pipelined) POST requests
      * with chunk coded content content over multiple connections.
      */
+    @Test
     public void testHttpPostsChunked() throws Exception {
         NHttpRequestExecutionHandler requestExecutionHandler = new RequestExecutionHandler() {
 
@@ -234,6 +232,7 @@ public class TestNIOSSLHttp extends Http
      * This test case executes a series of simple (non-pipelined) HTTP/1.0
      * POST requests over multiple persistent connections.
      */
+    @Test
     public void testHttpPostsHTTP10() throws Exception {
         NHttpRequestExecutionHandler requestExecutionHandler = new RequestExecutionHandler() {
 
@@ -260,6 +259,7 @@ public class TestNIOSSLHttp extends Http
      * over multiple connections using the 'expect: continue' handshake.  This test
      * uses nonblocking handlers & entities.
      */
+    @Test
     public void testHttpPostsWithExpectContinue() throws Exception {
         NHttpRequestExecutionHandler requestExecutionHandler = new RequestExecutionHandler() {
 

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestThrottlingNHttpHandlers.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestThrottlingNHttpHandlers.java?rev=1100965&r1=1100964&r2=1100965&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestThrottlingNHttpHandlers.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestThrottlingNHttpHandlers.java Mon May  9 11:26:57 2011
@@ -86,6 +86,10 @@ import org.apache.http.protocol.Response
 import org.apache.http.protocol.ResponseServer;
 import org.apache.http.util.EncodingUtils;
 import org.apache.http.util.EntityUtils;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * HttpCore NIO integration tests using throttling versions of the
@@ -93,24 +97,15 @@ import org.apache.http.util.EntityUtils;
  */
 public class TestThrottlingNHttpHandlers extends HttpCoreNIOTestBase {
 
-    // ------------------------------------------------------------ Constructor
-    public TestThrottlingNHttpHandlers(String testName) {
-        super(testName);
-    }
-
-    // ------------------------------------------------------- TestCase Methods
-
     private ExecutorService execService;
 
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
+    @Before
+    public void initExecService() throws Exception {
         this.execService = Executors.newCachedThreadPool();
     }
 
-    @Override
-    protected void tearDown() {
-        super.tearDown();
+    @After
+    public void shutDownExecService() {
         this.execService.shutdownNow();
     }
 
@@ -171,7 +166,7 @@ public class TestThrottlingNHttpHandlers
         endpoint.waitFor();
         InetSocketAddress serverAddress = (InetSocketAddress) endpoint.getAddress();
 
-        assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
+        Assert.assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
 
         Queue<SessionRequest> connRequests = new LinkedList<SessionRequest>();
         for (int i = 0; i < connNo; i++) {
@@ -187,19 +182,19 @@ public class TestThrottlingNHttpHandlers
             if (sessionRequest.getException() != null) {
                 throw sessionRequest.getException();
             }
-            assertNotNull(sessionRequest.getSession());
+            Assert.assertNotNull(sessionRequest.getSession());
         }
 
-        assertEquals("Test client status", IOReactorStatus.ACTIVE, this.client.getStatus());
+        Assert.assertEquals("Test client status", IOReactorStatus.ACTIVE, this.client.getStatus());
 
         for (int i = 0; i < jobs.length; i++) {
             Job testjob = jobs[i];
             testjob.waitFor();
             if (testjob.isSuccessful()) {
-                assertEquals(HttpStatus.SC_OK, testjob.getStatusCode());
-                assertEquals(testjob.getExpected(), testjob.getResult());
+                Assert.assertEquals(HttpStatus.SC_OK, testjob.getStatusCode());
+                Assert.assertEquals(testjob.getExpected(), testjob.getResult());
             } else {
-                fail(testjob.getFailureMessage());
+                Assert.fail(testjob.getFailureMessage());
             }
         }
     }
@@ -208,6 +203,7 @@ public class TestThrottlingNHttpHandlers
      * This test case executes a series of simple (non-pipelined) GET requests
      * over multiple connections.
      */
+    @Test
     public void testSimpleHttpGets() throws Exception {
         HttpRequestExecutionHandler requestExecutionHandler = new RequestExecutionHandler() {
 
@@ -225,6 +221,7 @@ public class TestThrottlingNHttpHandlers
      * This test case executes a series of simple (non-pipelined) POST requests
      * with content length delimited content over multiple connections.
      */
+    @Test
     public void testSimpleHttpPostsWithContentLength() throws Exception {
         HttpRequestExecutionHandler requestExecutionHandler = new RequestExecutionHandler() {
 
@@ -250,6 +247,7 @@ public class TestThrottlingNHttpHandlers
      * This test case executes a series of simple (non-pipelined) POST requests
      * with chunk coded content content over multiple connections.
      */
+    @Test
     public void testSimpleHttpPostsChunked() throws Exception {
         HttpRequestExecutionHandler requestExecutionHandler = new RequestExecutionHandler() {
 
@@ -276,6 +274,7 @@ public class TestThrottlingNHttpHandlers
      * (under the control of a ThrottlingHttpServiceHandler)
      * terminates when a connection timeout occurs.
      */
+    @Test
     public void testExecutorTermination() throws Exception {
         final int SHORT_TIMEOUT = 100;
         final int DEFAULT_SERVER_SO_TIMEOUT = 60000;
@@ -400,7 +399,7 @@ public class TestThrottlingNHttpHandlers
         endpoint.waitFor();
         InetSocketAddress serverAddress = (InetSocketAddress) endpoint.getAddress();
 
-        assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
+        Assert.assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
 
         SessionRequest sessionRequest = this.client.openConnection(
                 new InetSocketAddress("localhost", serverAddress.getPort()),
@@ -410,15 +409,15 @@ public class TestThrottlingNHttpHandlers
         if (sessionRequest.getException() != null) {
             throw sessionRequest.getException();
         }
-        assertNotNull(sessionRequest.getSession());
+        Assert.assertNotNull(sessionRequest.getSession());
 
-        assertEquals("Test client status", IOReactorStatus.ACTIVE, this.client.getStatus());
+        Assert.assertEquals("Test client status", IOReactorStatus.ACTIVE, this.client.getStatus());
 
         // wait for the client to invoke finalizeContext().
         synchronized (clientExpectations) {
             if (!clientExpectations.get(CLIENT_FINALIZED).booleanValue()) {
                 clientExpectations.wait(DEFAULT_SERVER_SO_TIMEOUT);
-                assertTrue(clientExpectations.get(CLIENT_FINALIZED).booleanValue());
+                Assert.assertTrue(clientExpectations.get(CLIENT_FINALIZED).booleanValue());
             }
         }
 
@@ -427,7 +426,7 @@ public class TestThrottlingNHttpHandlers
         synchronized (serverExpectations) {
             if (!serverExpectations.get(COMMAND_FINISHED).booleanValue()) {
                 serverExpectations.wait(SHORT_TIMEOUT);
-                assertTrue(serverExpectations.get(COMMAND_FINISHED).booleanValue());
+                Assert.assertTrue(serverExpectations.get(COMMAND_FINISHED).booleanValue());
             }
         }
 
@@ -439,6 +438,7 @@ public class TestThrottlingNHttpHandlers
      * This test case executes a series of simple (non-pipelined) HTTP/1.0
      * POST requests over multiple persistent connections.
      */
+    @Test
     public void testSimpleHttpPostsHTTP10() throws Exception {
         HttpRequestExecutionHandler requestExecutionHandler = new RequestExecutionHandler() {
 
@@ -464,6 +464,7 @@ public class TestThrottlingNHttpHandlers
      * This test case executes a series of simple (non-pipelined) POST requests
      * over multiple connections using the 'expect: continue' handshake.
      */
+    @Test
     public void testHttpPostsWithExpectContinue() throws Exception {
         HttpRequestExecutionHandler requestExecutionHandler = new RequestExecutionHandler() {
 
@@ -489,6 +490,7 @@ public class TestThrottlingNHttpHandlers
      * This test case executes a series of simple (non-pipelined) POST requests
      * over multiple connections that do not meet the target server expectations.
      */
+    @Test
     public void testHttpPostsWithExpectationVerification() throws Exception {
         Job[] jobs = new Job[3];
         jobs[0] = new Job("AAAAA", 10);
@@ -579,7 +581,7 @@ public class TestThrottlingNHttpHandlers
         endpoint.waitFor();
         InetSocketAddress serverAddress = (InetSocketAddress) endpoint.getAddress();
 
-        assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
+        Assert.assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
 
         SessionRequest sessionRequest = this.client.openConnection(
                 new InetSocketAddress("localhost", serverAddress.getPort()),
@@ -589,28 +591,29 @@ public class TestThrottlingNHttpHandlers
         if (sessionRequest.getException() != null) {
             throw sessionRequest.getException();
         }
-        assertNotNull(sessionRequest.getSession());
+        Assert.assertNotNull(sessionRequest.getSession());
 
-        assertEquals("Test client status", IOReactorStatus.ACTIVE, this.client.getStatus());
+        Assert.assertEquals("Test client status", IOReactorStatus.ACTIVE, this.client.getStatus());
 
         for (int i = 0; i < 2; i++) {
             Job testjob = jobs[i];
             testjob.waitFor();
             if (testjob.isSuccessful()) {
-                assertEquals(testjob.getExpected(), testjob.getResult());
+                Assert.assertEquals(testjob.getExpected(), testjob.getResult());
             } else {
-                fail(testjob.getFailureMessage());
+                Assert.fail(testjob.getFailureMessage());
             }
         }
         Job failedExpectation = jobs[2];
         failedExpectation.waitFor();
-        assertEquals(HttpStatus.SC_EXPECTATION_FAILED, failedExpectation.getStatusCode());
+        Assert.assertEquals(HttpStatus.SC_EXPECTATION_FAILED, failedExpectation.getStatusCode());
     }
 
     /**
      * This test case executes a series of simple (non-pipelined) HEAD requests
      * over multiple connections.
      */
+    @Test
     public void testSimpleHttpHeads() throws Exception {
         int connNo = 3;
         int reqNo = 20;
@@ -675,7 +678,7 @@ public class TestThrottlingNHttpHandlers
         endpoint.waitFor();
         InetSocketAddress serverAddress = (InetSocketAddress) endpoint.getAddress();
 
-        assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
+        Assert.assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
 
         Queue<SessionRequest> connRequests = new LinkedList<SessionRequest>();
         for (int i = 0; i < connNo; i++) {
@@ -691,19 +694,19 @@ public class TestThrottlingNHttpHandlers
             if (sessionRequest.getException() != null) {
                 throw sessionRequest.getException();
             }
-            assertNotNull(sessionRequest.getSession());
+            Assert.assertNotNull(sessionRequest.getSession());
         }
 
-        assertEquals("Test client status", IOReactorStatus.ACTIVE, this.client.getStatus());
+        Assert.assertEquals("Test client status", IOReactorStatus.ACTIVE, this.client.getStatus());
 
         for (int i = 0; i < jobs.length; i++) {
             Job testjob = jobs[i];
             testjob.waitFor();
             if (testjob.getFailureMessage() != null) {
-                fail(testjob.getFailureMessage());
+                Assert.fail(testjob.getFailureMessage());
             }
-            assertEquals(HttpStatus.SC_OK, testjob.getStatusCode());
-            assertNull(testjob.getResult());
+            Assert.assertEquals(HttpStatus.SC_OK, testjob.getStatusCode());
+            Assert.assertNull(testjob.getResult());
         }
     }
 
@@ -711,6 +714,7 @@ public class TestThrottlingNHttpHandlers
      * This test case tests if the protocol handler can correctly deal
      * with requests with partially consumed content.
      */
+    @Test
     public void testSimpleHttpPostsContentNotConsumed() throws Exception {
         HttpRequestHandler requestHandler = new HttpRequestHandler() {
 
@@ -797,7 +801,7 @@ public class TestThrottlingNHttpHandlers
         endpoint.waitFor();
         InetSocketAddress serverAddress = (InetSocketAddress) endpoint.getAddress();
 
-        assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
+        Assert.assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
 
         Queue<SessionRequest> connRequests = new LinkedList<SessionRequest>();
         for (int i = 0; i < connNo; i++) {
@@ -813,23 +817,24 @@ public class TestThrottlingNHttpHandlers
             if (sessionRequest.getException() != null) {
                 throw sessionRequest.getException();
             }
-            assertNotNull(sessionRequest.getSession());
+            Assert.assertNotNull(sessionRequest.getSession());
         }
 
-        assertEquals("Test client status", IOReactorStatus.ACTIVE, this.client.getStatus());
+        Assert.assertEquals("Test client status", IOReactorStatus.ACTIVE, this.client.getStatus());
 
         for (int i = 0; i < jobs.length; i++) {
             Job testjob = jobs[i];
             testjob.waitFor();
             if (testjob.isSuccessful()) {
-                assertEquals(HttpStatus.SC_INTERNAL_SERVER_ERROR, testjob.getStatusCode());
-                assertEquals("Ooopsie", testjob.getResult());
+                Assert.assertEquals(HttpStatus.SC_INTERNAL_SERVER_ERROR, testjob.getStatusCode());
+                Assert.assertEquals("Ooopsie", testjob.getResult());
             } else {
-                fail(testjob.getFailureMessage());
+                Assert.fail(testjob.getFailureMessage());
             }
         }
     }
 
+    @Test
     public void testInputThrottling() throws Exception {
         HttpRequestExecutionHandler requestExecutionHandler = new HttpRequestExecutionHandler() {
 
@@ -960,7 +965,7 @@ public class TestThrottlingNHttpHandlers
         endpoint.waitFor();
         InetSocketAddress serverAddress = (InetSocketAddress) endpoint.getAddress();
 
-        assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
+        Assert.assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
 
         Queue<SessionRequest> connRequests = new LinkedList<SessionRequest>();
         for (int i = 0; i < connNo; i++) {
@@ -976,19 +981,19 @@ public class TestThrottlingNHttpHandlers
             if (sessionRequest.getException() != null) {
                 throw sessionRequest.getException();
             }
-            assertNotNull(sessionRequest.getSession());
+            Assert.assertNotNull(sessionRequest.getSession());
         }
 
-        assertEquals("Test client status", IOReactorStatus.ACTIVE, this.client.getStatus());
+        Assert.assertEquals("Test client status", IOReactorStatus.ACTIVE, this.client.getStatus());
 
         for (int i = 0; i < jobs.length; i++) {
             Job testjob = jobs[i];
             testjob.waitFor();
             if (testjob.isSuccessful()) {
-                assertEquals(HttpStatus.SC_OK, testjob.getStatusCode());
-                assertEquals(testjob.getExpected(), testjob.getResult());
+                Assert.assertEquals(HttpStatus.SC_OK, testjob.getStatusCode());
+                Assert.assertEquals(testjob.getExpected(), testjob.getResult());
             } else {
-                fail(testjob.getFailureMessage());
+                Assert.fail(testjob.getFailureMessage());
             }
         }
     }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestTruncatedChunks.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestTruncatedChunks.java?rev=1100965&r1=1100964&r2=1100965&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestTruncatedChunks.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestTruncatedChunks.java Mon May  9 11:26:57 2011
@@ -33,12 +33,9 @@ import java.io.OutputStream;
 import java.net.InetSocketAddress;
 import java.nio.ByteBuffer;
 import java.nio.channels.WritableByteChannel;
-import java.util.List;
 import java.util.Queue;
 import java.util.concurrent.ConcurrentLinkedQueue;
 
-import junit.framework.TestCase;
-
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpRequestInterceptor;
@@ -55,12 +52,11 @@ import org.apache.http.impl.io.HttpTrans
 import org.apache.http.impl.nio.DefaultNHttpServerConnection;
 import org.apache.http.impl.nio.DefaultServerIOEventDispatch;
 import org.apache.http.impl.nio.codecs.AbstractContentEncoder;
-import org.apache.http.impl.nio.reactor.ExceptionEvent;
 import org.apache.http.message.BasicHttpRequest;
-import org.apache.http.mockup.SimpleEventListener;
-import org.apache.http.mockup.SimpleNHttpRequestHandlerResolver;
 import org.apache.http.mockup.HttpClientNio;
 import org.apache.http.mockup.HttpServerNio;
+import org.apache.http.mockup.SimpleEventListener;
+import org.apache.http.mockup.SimpleNHttpRequestHandlerResolver;
 import org.apache.http.nio.ContentDecoder;
 import org.apache.http.nio.ContentEncoder;
 import org.apache.http.nio.IOControl;
@@ -93,18 +89,15 @@ import org.apache.http.protocol.Response
 import org.apache.http.protocol.ResponseDate;
 import org.apache.http.protocol.ResponseServer;
 import org.apache.http.util.CharArrayBuffer;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * Tests for handling truncated chunks.
  */
-public class TestTruncatedChunks extends TestCase {
-
-    // ------------------------------------------------------------ Constructor
-    public TestTruncatedChunks(String testName) {
-        super(testName);
-    }
-
-    // ------------------------------------------------------- TestCase Methods
+public class TestTruncatedChunks {
 
     private static final byte[] GARBAGE = new byte[] {'1', '2', '3', '4', '5' };
 
@@ -202,8 +195,8 @@ public class TestTruncatedChunks extends
     protected CustomTestHttpServer server;
     protected HttpClientNio client;
 
-    @Override
-    protected void setUp() throws Exception {
+    @Before
+    public void initServer() throws Exception {
         HttpParams serverParams = new SyncBasicHttpParams();
         serverParams
             .setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 60000)
@@ -213,7 +206,10 @@ public class TestTruncatedChunks extends
             .setParameter(CoreProtocolPNames.ORIGIN_SERVER, "TEST-SERVER/1.1");
 
         this.server = new CustomTestHttpServer(serverParams);
+    }
 
+    @Before
+    public void initClient() throws Exception {
         HttpParams clientParams = new SyncBasicHttpParams();
         clientParams
             .setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 60000)
@@ -226,35 +222,21 @@ public class TestTruncatedChunks extends
         this.client = new HttpClientNio(clientParams);
     }
 
-    @Override
-    protected void tearDown() {
-        try {
+    @After
+    public void shutDownClient() throws Exception {
+        if (this.client != null) {
             this.client.shutdown();
-        } catch (IOException ex) {
-            ex.printStackTrace();
-        }
-        List<ExceptionEvent> clogs = this.client.getAuditLog();
-        if (clogs != null) {
-            for (ExceptionEvent clog: clogs) {
-                Throwable cause = clog.getCause();
-                cause.printStackTrace();
-            }
         }
+    }
 
-        try {
+    @After
+    public void shutDownServer() throws Exception {
+        if (this.server != null) {
             this.server.shutdown();
-        } catch (IOException ex) {
-            ex.printStackTrace();
-        }
-        List<ExceptionEvent> slogs = this.server.getAuditLog();
-        if (slogs != null) {
-            for (ExceptionEvent slog: slogs) {
-                Throwable cause = slog.getCause();
-                cause.printStackTrace();
-            }
         }
     }
 
+    @Test
     public void testTruncatedChunkException() throws Exception {
 
         NHttpRequestExecutionHandler requestExecutionHandler = new RequestExecutionHandler() {
@@ -328,9 +310,9 @@ public class TestTruncatedChunks extends
                 queue);
 
         testjob.waitFor();
-        assertFalse(testjob.isSuccessful());
-        assertNotNull(testjob.getException());
-        assertTrue(testjob.getException() instanceof MalformedChunkCodingException);
+        Assert.assertFalse(testjob.isSuccessful());
+        Assert.assertNotNull(testjob.getException());
+        Assert.assertTrue(testjob.getException() instanceof MalformedChunkCodingException);
     }
 
     static class LenientNHttpEntity extends HttpEntityWrapper implements ConsumingNHttpEntity {
@@ -408,6 +390,7 @@ public class TestTruncatedChunks extends
 
     }
 
+    @Test
     public void testIgnoreTruncatedChunkException() throws Exception {
 
         NHttpRequestExecutionHandler requestExecutionHandler = new RequestExecutionHandler() {
@@ -479,10 +462,10 @@ public class TestTruncatedChunks extends
 
         testjob.waitFor();
         if (testjob.isSuccessful()) {
-            assertEquals(HttpStatus.SC_OK, testjob.getStatusCode());
-            assertEquals(new String(GARBAGE, "US-ASCII"), testjob.getResult());
+            Assert.assertEquals(HttpStatus.SC_OK, testjob.getStatusCode());
+            Assert.assertEquals(new String(GARBAGE, "US-ASCII"), testjob.getResult());
         } else {
-            fail(testjob.getFailureMessage());
+            Assert.fail(testjob.getFailureMessage());
         }
     }
 

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/util/TestBuffers.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/util/TestBuffers.java?rev=1100965&r1=1100964&r2=1100965&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/util/TestBuffers.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/util/TestBuffers.java Mon May  9 11:26:57 2011
@@ -34,8 +34,6 @@ import java.nio.channels.Channels;
 import java.nio.channels.ReadableByteChannel;
 import java.nio.channels.WritableByteChannel;
 
-import junit.framework.TestCase;
-
 import org.apache.http.impl.io.HttpTransportMetricsImpl;
 import org.apache.http.impl.nio.reactor.SessionOutputBufferImpl;
 import org.apache.http.io.BufferInfo;
@@ -48,22 +46,15 @@ import org.apache.http.nio.reactor.Sessi
 import org.apache.http.params.BasicHttpParams;
 import org.apache.http.params.HttpParams;
 import org.apache.http.util.EncodingUtils;
+import org.junit.Assert;
+import org.junit.Test;
 
 /**
  * Buffer tests.
- *
- *
- * @version $Id:TestBuffers.java 503277 2007-02-03 18:22:45 +0000 (Sat, 03 Feb 2007) olegk $
  */
-public class TestBuffers extends TestCase {
-
-    // ------------------------------------------------------------ Constructor
-    public TestBuffers(String testName) {
-        super(testName);
-    }
-
-    // ------------------------------------------------------- TestCase Methods
+public class TestBuffers {
 
+    @Test
     public void testInputBufferOperations() throws IOException {
         ReadableByteChannel channel = new ReadableByteChannelMockup(
                 new String[] {"stuff;", "more stuff"}, "US-ASCII");
@@ -72,31 +63,32 @@ public class TestBuffers extends TestCas
 
         SimpleInputBuffer buffer = new SimpleInputBuffer(4, new DirectByteBufferAllocator());
         int count = buffer.consumeContent(decoder);
-        assertEquals(16, count);
-        assertTrue(decoder.isCompleted());
+        Assert.assertEquals(16, count);
+        Assert.assertTrue(decoder.isCompleted());
 
         byte[] b1 = new byte[5];
 
         int len = buffer.read(b1);
-        assertEquals("stuff", EncodingUtils.getAsciiString(b1, 0, len));
+        Assert.assertEquals("stuff", EncodingUtils.getAsciiString(b1, 0, len));
 
         int c = buffer.read();
-        assertEquals(';', c);
+        Assert.assertEquals(';', c);
 
         byte[] b2 = new byte[1024];
 
         len = buffer.read(b2);
-        assertEquals("more stuff", EncodingUtils.getAsciiString(b2, 0, len));
+        Assert.assertEquals("more stuff", EncodingUtils.getAsciiString(b2, 0, len));
 
-        assertEquals(-1, buffer.read());
-        assertEquals(-1, buffer.read(b2));
-        assertEquals(-1, buffer.read(b2, 0, b2.length));
-        assertTrue(buffer.isEndOfStream());
+        Assert.assertEquals(-1, buffer.read());
+        Assert.assertEquals(-1, buffer.read(b2));
+        Assert.assertEquals(-1, buffer.read(b2, 0, b2.length));
+        Assert.assertTrue(buffer.isEndOfStream());
 
         buffer.reset();
-        assertFalse(buffer.isEndOfStream());
+        Assert.assertFalse(buffer.isEndOfStream());
     }
 
+    @Test
     public void testOutputBufferOperations() throws IOException {
         ByteArrayOutputStream outstream = new ByteArrayOutputStream();
         WritableByteChannel channel = Channels.newChannel(outstream);
@@ -117,78 +109,83 @@ public class TestBuffers extends TestCas
         buffer.produceContent(encoder);
 
         byte[] content = outstream.toByteArray();
-        assertEquals("stuff;more stuff", EncodingUtils.getAsciiString(content));
+        Assert.assertEquals("stuff;more stuff", EncodingUtils.getAsciiString(content));
     }
 
+    @Test
     public void testBufferInfo() throws Exception {
         SimpleOutputBuffer buffer = new SimpleOutputBuffer(8, new DirectByteBufferAllocator());
         BufferInfo bufferinfo = buffer;
 
-        assertEquals(0, bufferinfo.length());
-        assertEquals(8, bufferinfo.available());
+        Assert.assertEquals(0, bufferinfo.length());
+        Assert.assertEquals(8, bufferinfo.available());
         buffer.write(new byte[] {'1', '2', '3', '4'});
-        assertEquals(4, bufferinfo.length());
-        assertEquals(4, bufferinfo.available());
+        Assert.assertEquals(4, bufferinfo.length());
+        Assert.assertEquals(4, bufferinfo.available());
         buffer.write(new byte[] {'1', '2', '3', '4', '5', '6', '7', '8'});
-        assertEquals(12, bufferinfo.length());
-        assertEquals(0, bufferinfo.available());
+        Assert.assertEquals(12, bufferinfo.length());
+        Assert.assertEquals(0, bufferinfo.available());
     }
 
+    @Test
     public void testInputBufferNullInput() throws IOException {
         SimpleInputBuffer buffer = new SimpleInputBuffer(4, new DirectByteBufferAllocator());
-        assertEquals(0, buffer.read(null));
-        assertEquals(0, buffer.read(null, 0, 0));
+        Assert.assertEquals(0, buffer.read(null));
+        Assert.assertEquals(0, buffer.read(null, 0, 0));
     }
 
+    @Test
     public void testOutputBufferNullInput() throws IOException {
         SimpleOutputBuffer buffer = new SimpleOutputBuffer(4, new DirectByteBufferAllocator());
         buffer.write(null);
         buffer.write(null, 0, 10);
-        assertFalse(buffer.hasData());
+        Assert.assertFalse(buffer.hasData());
     }
 
+    @Test
     public void testDirectByteBufferAllocator() {
         DirectByteBufferAllocator allocator = new DirectByteBufferAllocator();
         ByteBuffer buffer = allocator.allocate(1);
-        assertNotNull(buffer);
-        assertTrue(buffer.isDirect());
-        assertEquals(0, buffer.position());
-        assertEquals(1, buffer.limit());
-        assertEquals(1, buffer.capacity());
+        Assert.assertNotNull(buffer);
+        Assert.assertTrue(buffer.isDirect());
+        Assert.assertEquals(0, buffer.position());
+        Assert.assertEquals(1, buffer.limit());
+        Assert.assertEquals(1, buffer.capacity());
 
         buffer = allocator.allocate(2048);
-        assertTrue(buffer.isDirect());
-        assertEquals(0, buffer.position());
-        assertEquals(2048, buffer.limit());
-        assertEquals(2048, buffer.capacity());
+        Assert.assertTrue(buffer.isDirect());
+        Assert.assertEquals(0, buffer.position());
+        Assert.assertEquals(2048, buffer.limit());
+        Assert.assertEquals(2048, buffer.capacity());
 
         buffer = allocator.allocate(0);
-        assertTrue(buffer.isDirect());
-        assertEquals(0, buffer.position());
-        assertEquals(0, buffer.limit());
-        assertEquals(0, buffer.capacity());
+        Assert.assertTrue(buffer.isDirect());
+        Assert.assertEquals(0, buffer.position());
+        Assert.assertEquals(0, buffer.limit());
+        Assert.assertEquals(0, buffer.capacity());
     }
 
+    @Test
     public void testHeapByteBufferAllocator() {
         HeapByteBufferAllocator allocator = new HeapByteBufferAllocator();
         ByteBuffer buffer = allocator.allocate(1);
-        assertNotNull(buffer);
-        assertFalse(buffer.isDirect());
-        assertEquals(0, buffer.position());
-        assertEquals(1, buffer.limit());
-        assertEquals(1, buffer.capacity());
+        Assert.assertNotNull(buffer);
+        Assert.assertFalse(buffer.isDirect());
+        Assert.assertEquals(0, buffer.position());
+        Assert.assertEquals(1, buffer.limit());
+        Assert.assertEquals(1, buffer.capacity());
 
         buffer = allocator.allocate(2048);
-        assertFalse(buffer.isDirect());
-        assertEquals(0, buffer.position());
-        assertEquals(2048, buffer.limit());
-        assertEquals(2048, buffer.capacity());
+        Assert.assertFalse(buffer.isDirect());
+        Assert.assertEquals(0, buffer.position());
+        Assert.assertEquals(2048, buffer.limit());
+        Assert.assertEquals(2048, buffer.capacity());
 
         buffer = allocator.allocate(0);
-        assertFalse(buffer.isDirect());
-        assertEquals(0, buffer.position());
-        assertEquals(0, buffer.limit());
-        assertEquals(0, buffer.capacity());
+        Assert.assertFalse(buffer.isDirect());
+        Assert.assertEquals(0, buffer.position());
+        Assert.assertEquals(0, buffer.limit());
+        Assert.assertEquals(0, buffer.capacity());
     }
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/TestHttpExceptions.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/TestHttpExceptions.java?rev=1100965&r1=1100964&r2=1100965&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/TestHttpExceptions.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/TestHttpExceptions.java Mon May  9 11:26:57 2011
@@ -27,22 +27,16 @@
 
 package org.apache.http;
 
-import junit.framework.TestCase;
+import org.junit.Test;
 
 /**
  * Simple tests for various HTTP exception classes.
  *
  *
  */
-public class TestHttpExceptions extends TestCase {
-
-    // ------------------------------------------------------------ Constructor
-    public TestHttpExceptions(String testName) {
-        super(testName);
-    }
-
-    // ------------------------------------------------------- TestCase Methods
+public class TestHttpExceptions {
 
+    @Test
     public void testConstructor() {
         Throwable cause = new Exception();
         new HttpException();

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/TestHttpHost.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/TestHttpHost.java?rev=1100965&r1=1100964&r2=1100965&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/TestHttpHost.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/TestHttpHost.java Mon May  9 11:26:57 2011
@@ -32,43 +32,42 @@ import java.io.ByteArrayOutputStream;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 
-import junit.framework.TestCase;
+import org.junit.Assert;
+import org.junit.Test;
 
 /**
  * Unit tests for {@link HttpHost}.
  *
  */
-public class TestHttpHost extends TestCase {
-
-    public TestHttpHost(String testName) {
-        super(testName);
-    }
+public class TestHttpHost {
 
+    @Test
     public void testConstructor() {
         HttpHost host1 = new HttpHost("somehost");
-        assertEquals("somehost", host1.getHostName());
-        assertEquals(-1, host1.getPort());
-        assertEquals("http", host1.getSchemeName());
+        Assert.assertEquals("somehost", host1.getHostName());
+        Assert.assertEquals(-1, host1.getPort());
+        Assert.assertEquals("http", host1.getSchemeName());
         HttpHost host2 = new HttpHost("somehost", 8080);
-        assertEquals("somehost", host2.getHostName());
-        assertEquals(8080, host2.getPort());
-        assertEquals("http", host2.getSchemeName());
+        Assert.assertEquals("somehost", host2.getHostName());
+        Assert.assertEquals(8080, host2.getPort());
+        Assert.assertEquals("http", host2.getSchemeName());
         HttpHost host3 = new HttpHost("somehost", -1);
-        assertEquals("somehost", host3.getHostName());
-        assertEquals(-1, host3.getPort());
-        assertEquals("http", host3.getSchemeName());
+        Assert.assertEquals("somehost", host3.getHostName());
+        Assert.assertEquals(-1, host3.getPort());
+        Assert.assertEquals("http", host3.getSchemeName());
         HttpHost host4 = new HttpHost("somehost", 443, "https");
-        assertEquals("somehost", host4.getHostName());
-        assertEquals(443, host4.getPort());
-        assertEquals("https", host4.getSchemeName());
+        Assert.assertEquals("somehost", host4.getHostName());
+        Assert.assertEquals(443, host4.getPort());
+        Assert.assertEquals("https", host4.getSchemeName());
         try {
             new HttpHost(null, -1, null);
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             //expected
         }
     }
 
+    @Test
     public void testHashCode() {
         HttpHost host1 = new HttpHost("somehost", 8080, "http");
         HttpHost host2 = new HttpHost("somehost", 80, "http");
@@ -77,14 +76,15 @@ public class TestHttpHost extends TestCa
         HttpHost host5 = new HttpHost("SomeHost", 80, "http");
         HttpHost host6 = new HttpHost("SomeHost", 80, "myhttp");
 
-        assertTrue(host1.hashCode() == host1.hashCode());
-        assertTrue(host1.hashCode() != host2.hashCode());
-        assertTrue(host1.hashCode() != host3.hashCode());
-        assertTrue(host2.hashCode() == host4.hashCode());
-        assertTrue(host2.hashCode() == host5.hashCode());
-        assertTrue(host5.hashCode() != host6.hashCode());
+        Assert.assertTrue(host1.hashCode() == host1.hashCode());
+        Assert.assertTrue(host1.hashCode() != host2.hashCode());
+        Assert.assertTrue(host1.hashCode() != host3.hashCode());
+        Assert.assertTrue(host2.hashCode() == host4.hashCode());
+        Assert.assertTrue(host2.hashCode() == host5.hashCode());
+        Assert.assertTrue(host5.hashCode() != host6.hashCode());
     }
 
+    @Test
     public void testEquals() {
         HttpHost host1 = new HttpHost("somehost", 8080, "http");
         HttpHost host2 = new HttpHost("somehost", 80, "http");
@@ -93,48 +93,52 @@ public class TestHttpHost extends TestCa
         HttpHost host5 = new HttpHost("SomeHost", 80, "http");
         HttpHost host6 = new HttpHost("SomeHost", 80, "myhttp");
 
-        assertTrue(host1.equals(host1));
-        assertFalse(host1.equals(host2));
-        assertFalse(host1.equals(host3));
-        assertTrue(host2.equals(host4));
-        assertTrue(host2.equals(host5));
-        assertFalse(host5.equals(host6));
-        assertFalse(host1.equals(null));
-        assertFalse(host1.equals("http://somehost"));
+        Assert.assertTrue(host1.equals(host1));
+        Assert.assertFalse(host1.equals(host2));
+        Assert.assertFalse(host1.equals(host3));
+        Assert.assertTrue(host2.equals(host4));
+        Assert.assertTrue(host2.equals(host5));
+        Assert.assertFalse(host5.equals(host6));
+        Assert.assertFalse(host1.equals(null));
+        Assert.assertFalse(host1.equals("http://somehost"));
     }
 
+    @Test
     public void testToString() {
         HttpHost host1 = new HttpHost("somehost");
-        assertEquals("http://somehost", host1.toString());
+        Assert.assertEquals("http://somehost", host1.toString());
         HttpHost host2 = new HttpHost("somehost", -1);
-        assertEquals("http://somehost", host2.toString());
+        Assert.assertEquals("http://somehost", host2.toString());
         HttpHost host3 = new HttpHost("somehost", -1);
-        assertEquals("http://somehost", host3.toString());
+        Assert.assertEquals("http://somehost", host3.toString());
         HttpHost host4 = new HttpHost("somehost", 8888);
-        assertEquals("http://somehost:8888", host4.toString());
+        Assert.assertEquals("http://somehost:8888", host4.toString());
         HttpHost host5 = new HttpHost("somehost", -1, "myhttp");
-        assertEquals("myhttp://somehost", host5.toString());
+        Assert.assertEquals("myhttp://somehost", host5.toString());
         HttpHost host6 = new HttpHost("somehost", 80, "myhttp");
-        assertEquals("myhttp://somehost:80", host6.toString());
+        Assert.assertEquals("myhttp://somehost:80", host6.toString());
     }
 
+    @Test
     public void testToHostString() {
         HttpHost host1 = new HttpHost("somehost");
-        assertEquals("somehost", host1.toHostString());
+        Assert.assertEquals("somehost", host1.toHostString());
         HttpHost host2 = new HttpHost("somehost");
-        assertEquals("somehost", host2.toHostString());
+        Assert.assertEquals("somehost", host2.toHostString());
         HttpHost host3 = new HttpHost("somehost", -1);
-        assertEquals("somehost", host3.toHostString());
+        Assert.assertEquals("somehost", host3.toHostString());
         HttpHost host4 = new HttpHost("somehost", 8888);
-        assertEquals("somehost:8888", host4.toHostString());
+        Assert.assertEquals("somehost:8888", host4.toHostString());
     }
 
+    @Test
     public void testCloning() throws Exception {
         HttpHost orig = new HttpHost("somehost", 8080, "https");
         HttpHost clone = (HttpHost) orig.clone();
-        assertEquals(orig, clone);
+        Assert.assertEquals(orig, clone);
     }
 
+    @Test
     public void testSerialization() throws Exception {
         HttpHost orig = new HttpHost("somehost", 8080, "https");
         ByteArrayOutputStream outbuffer = new ByteArrayOutputStream();
@@ -145,7 +149,7 @@ public class TestHttpHost extends TestCa
         ByteArrayInputStream inbuffer = new ByteArrayInputStream(raw);
         ObjectInputStream instream = new ObjectInputStream(inbuffer);
         HttpHost clone = (HttpHost) instream.readObject();
-        assertEquals(orig, clone);
+        Assert.assertEquals(orig, clone);
     }
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/TestHttpVersion.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/TestHttpVersion.java?rev=1100965&r1=1100964&r2=1100965&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/TestHttpVersion.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/TestHttpVersion.java Mon May  9 11:26:57 2011
@@ -32,89 +32,87 @@ import java.io.ByteArrayOutputStream;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 
-import junit.framework.TestCase;
+import org.junit.Assert;
+import org.junit.Test;
 
 /**
  * Test cases for HTTP version class
  *
  */
-public class TestHttpVersion extends TestCase {
-
-    // ------------------------------------------------------------ Constructor
-
-    public TestHttpVersion(String name) {
-        super(name);
-    }
-
-    // ------------------------------------------------------------------ Tests
+public class TestHttpVersion {
 
+    @Test
     public void testHttpVersionInvalidConstructorInput() throws Exception {
         try {
             new HttpVersion(-1, -1);
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException e) {
             // expected
         }
         try {
             new HttpVersion(0, -1);
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException e) {
             // expected
         }
     }
 
+    @Test
     public void testHttpVersionEquality() throws Exception {
         HttpVersion ver1 = new HttpVersion(1, 1);
         HttpVersion ver2 = new HttpVersion(1, 1);
 
-        assertEquals(ver1.hashCode(), ver2.hashCode());
-        assertTrue(ver1.equals(ver1));
-        assertTrue(ver1.equals(ver2));
-        assertTrue(ver1.equals(ver1));
-        assertTrue(ver1.equals(ver2));
-
-        assertFalse(ver1.equals(new Float(1.1)));
-
-        assertTrue((new HttpVersion(0, 9)).equals(HttpVersion.HTTP_0_9));
-        assertTrue((new HttpVersion(1, 0)).equals(HttpVersion.HTTP_1_0));
-        assertTrue((new HttpVersion(1, 1)).equals(HttpVersion.HTTP_1_1));
-        assertFalse((new HttpVersion(1, 1)).equals(HttpVersion.HTTP_1_0));
+        Assert.assertEquals(ver1.hashCode(), ver2.hashCode());
+        Assert.assertTrue(ver1.equals(ver1));
+        Assert.assertTrue(ver1.equals(ver2));
+        Assert.assertTrue(ver1.equals(ver1));
+        Assert.assertTrue(ver1.equals(ver2));
+
+        Assert.assertFalse(ver1.equals(new Float(1.1)));
+
+        Assert.assertTrue((new HttpVersion(0, 9)).equals(HttpVersion.HTTP_0_9));
+        Assert.assertTrue((new HttpVersion(1, 0)).equals(HttpVersion.HTTP_1_0));
+        Assert.assertTrue((new HttpVersion(1, 1)).equals(HttpVersion.HTTP_1_1));
+        Assert.assertFalse((new HttpVersion(1, 1)).equals(HttpVersion.HTTP_1_0));
 
-        assertTrue
+        Assert.assertTrue
             ((new ProtocolVersion("HTTP", 0, 9)).equals(HttpVersion.HTTP_0_9));
-        assertTrue
+        Assert.assertTrue
             ((new ProtocolVersion("HTTP", 1, 0)).equals(HttpVersion.HTTP_1_0));
-        assertTrue
+        Assert.assertTrue
             ((new ProtocolVersion("HTTP", 1, 1)).equals(HttpVersion.HTTP_1_1));
-        assertFalse
+        Assert.assertFalse
             ((new ProtocolVersion("http", 1, 1)).equals(HttpVersion.HTTP_1_1));
 
-        assertTrue
+        Assert.assertTrue
             (HttpVersion.HTTP_0_9.equals(new ProtocolVersion("HTTP", 0, 9)));
-        assertTrue
+        Assert.assertTrue
             (HttpVersion.HTTP_1_0.equals(new ProtocolVersion("HTTP", 1, 0)));
-        assertTrue
+        Assert.assertTrue
             (HttpVersion.HTTP_1_1.equals(new ProtocolVersion("HTTP", 1, 1)));
-        assertFalse
+        Assert.assertFalse
             (HttpVersion.HTTP_1_1.equals(new ProtocolVersion("http", 1, 1)));
     }
 
+    @Test
     public void testHttpVersionComparison() {
-        assertTrue(HttpVersion.HTTP_0_9.lessEquals(HttpVersion.HTTP_1_1));
-        assertTrue(HttpVersion.HTTP_0_9.greaterEquals(HttpVersion.HTTP_0_9));
-        assertFalse(HttpVersion.HTTP_0_9.greaterEquals(HttpVersion.HTTP_1_0));
-
-        assertTrue(HttpVersion.HTTP_1_0.compareToVersion(HttpVersion.HTTP_1_1) < 0);
-        assertTrue(HttpVersion.HTTP_1_0.compareToVersion(HttpVersion.HTTP_0_9) > 0);
-        assertTrue(HttpVersion.HTTP_1_0.compareToVersion(HttpVersion.HTTP_1_0) == 0);
+        Assert.assertTrue(HttpVersion.HTTP_0_9.lessEquals(HttpVersion.HTTP_1_1));
+        Assert.assertTrue(HttpVersion.HTTP_0_9.greaterEquals(HttpVersion.HTTP_0_9));
+        Assert.assertFalse(HttpVersion.HTTP_0_9.greaterEquals(HttpVersion.HTTP_1_0));
+
+        Assert.assertTrue(HttpVersion.HTTP_1_0.compareToVersion(HttpVersion.HTTP_1_1) < 0);
+        Assert.assertTrue(HttpVersion.HTTP_1_0.compareToVersion(HttpVersion.HTTP_0_9) > 0);
+        Assert.assertTrue(HttpVersion.HTTP_1_0.compareToVersion(HttpVersion.HTTP_1_0) == 0);
    }
 
+    @Test
     public void testCloning() throws Exception {
         HttpVersion orig = HttpVersion.HTTP_1_1;
         HttpVersion clone = (HttpVersion) orig.clone();
-        assertEquals(orig, clone);
+        Assert.assertEquals(orig, clone);
     }
 
+    @Test
     public void testSerialization() throws Exception {
         HttpVersion orig = HttpVersion.HTTP_1_1;
         ByteArrayOutputStream outbuffer = new ByteArrayOutputStream();
@@ -125,7 +123,7 @@ public class TestHttpVersion extends Tes
         ByteArrayInputStream inbuffer = new ByteArrayInputStream(raw);
         ObjectInputStream instream = new ObjectInputStream(inbuffer);
         HttpVersion clone = (HttpVersion) instream.readObject();
-        assertEquals(orig, clone);
+        Assert.assertEquals(orig, clone);
     }
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestAbstractHttpEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestAbstractHttpEntity.java?rev=1100965&r1=1100964&r2=1100965&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestAbstractHttpEntity.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestAbstractHttpEntity.java Mon May  9 11:26:57 2011
@@ -27,60 +27,59 @@
 
 package org.apache.http.entity;
 
-import junit.framework.TestCase;
-
 import org.apache.http.Header;
 import org.apache.http.message.BasicHeader;
 import org.apache.http.mockup.HttpEntityMockup;
 import org.apache.http.protocol.HTTP;
+import org.junit.Assert;
+import org.junit.Test;
 
 /**
  * Unit tests for {@link AbstractHttpEntity}.
  *
  */
-public class TestAbstractHttpEntity extends TestCase {
-
-    public TestAbstractHttpEntity(String testName) {
-        super(testName);
-    }
+public class TestAbstractHttpEntity {
 
+    @Test
     public void testContentType() throws Exception {
         HttpEntityMockup httpentity = new HttpEntityMockup();
         httpentity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, HTTP.PLAIN_TEXT_TYPE));
-        assertEquals(HTTP.CONTENT_TYPE, httpentity.getContentType().getName());
-        assertEquals(HTTP.PLAIN_TEXT_TYPE, httpentity.getContentType().getValue());
+        Assert.assertEquals(HTTP.CONTENT_TYPE, httpentity.getContentType().getName());
+        Assert.assertEquals(HTTP.PLAIN_TEXT_TYPE, httpentity.getContentType().getValue());
 
         httpentity.setContentType(HTTP.PLAIN_TEXT_TYPE);
-        assertEquals(HTTP.CONTENT_TYPE, httpentity.getContentType().getName());
-        assertEquals(HTTP.PLAIN_TEXT_TYPE, httpentity.getContentType().getValue());
+        Assert.assertEquals(HTTP.CONTENT_TYPE, httpentity.getContentType().getName());
+        Assert.assertEquals(HTTP.PLAIN_TEXT_TYPE, httpentity.getContentType().getValue());
 
         httpentity.setContentType((Header)null);
-        assertNull(httpentity.getContentType());
+        Assert.assertNull(httpentity.getContentType());
         httpentity.setContentType((String)null);
-        assertNull(httpentity.getContentType());
+        Assert.assertNull(httpentity.getContentType());
     }
 
+    @Test
     public void testContentEncoding() throws Exception {
         HttpEntityMockup httpentity = new HttpEntityMockup();
         httpentity.setContentEncoding(new BasicHeader(HTTP.CONTENT_ENCODING, "gzip"));
-        assertEquals(HTTP.CONTENT_ENCODING, httpentity.getContentEncoding().getName());
-        assertEquals("gzip", httpentity.getContentEncoding().getValue());
+        Assert.assertEquals(HTTP.CONTENT_ENCODING, httpentity.getContentEncoding().getName());
+        Assert.assertEquals("gzip", httpentity.getContentEncoding().getValue());
 
         httpentity.setContentEncoding("gzip");
-        assertEquals(HTTP.CONTENT_ENCODING, httpentity.getContentEncoding().getName());
-        assertEquals("gzip", httpentity.getContentEncoding().getValue());
+        Assert.assertEquals(HTTP.CONTENT_ENCODING, httpentity.getContentEncoding().getName());
+        Assert.assertEquals("gzip", httpentity.getContentEncoding().getValue());
 
         httpentity.setContentEncoding((Header)null);
-        assertNull(httpentity.getContentEncoding());
+        Assert.assertNull(httpentity.getContentEncoding());
         httpentity.setContentEncoding((String)null);
-        assertNull(httpentity.getContentEncoding());
+        Assert.assertNull(httpentity.getContentEncoding());
     }
 
+    @Test
     public void testChunkingFlag() throws Exception {
         HttpEntityMockup httpentity = new HttpEntityMockup();
-        assertFalse(httpentity.isChunked());
+        Assert.assertFalse(httpentity.isChunked());
         httpentity.setChunked(true);
-        assertTrue(httpentity.isChunked());
+        Assert.assertTrue(httpentity.isChunked());
     }
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestBasicHttpEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestBasicHttpEntity.java?rev=1100965&r1=1100964&r2=1100965&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestBasicHttpEntity.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestBasicHttpEntity.java Mon May  9 11:26:57 2011
@@ -32,19 +32,16 @@ import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
 
 import org.apache.http.protocol.HTTP;
-
-import junit.framework.TestCase;
+import org.junit.Assert;
+import org.junit.Test;
 
 /**
  * Unit tests for {@link BasicHttpEntity}.
  *
  */
-public class TestBasicHttpEntity extends TestCase {
-
-    public TestBasicHttpEntity(String testName) {
-        super(testName);
-    }
+public class TestBasicHttpEntity {
 
+    @Test
     public void testBasics() throws Exception {
 
         byte[] bytes = "Message content".getBytes(HTTP.US_ASCII);
@@ -53,33 +50,35 @@ public class TestBasicHttpEntity extends
         httpentity.setContent(content);
         httpentity.setContentLength(bytes.length);
 
-        assertEquals(bytes.length, httpentity.getContentLength());
-        assertFalse(httpentity.isRepeatable());
-        assertTrue(httpentity.isStreaming());
+        Assert.assertEquals(bytes.length, httpentity.getContentLength());
+        Assert.assertFalse(httpentity.isRepeatable());
+        Assert.assertTrue(httpentity.isStreaming());
     }
 
+    @Test
     public void testContent() throws Exception {
         byte[] bytes = "Message content".getBytes(HTTP.US_ASCII);
         InputStream content = new ByteArrayInputStream(bytes);
         BasicHttpEntity httpentity = new BasicHttpEntity();
         try {
             httpentity.getContent();
-            fail("IllegalStateException should have been thrown");
+            Assert.fail("IllegalStateException should have been thrown");
         } catch (IllegalStateException ex) {
             // expected
         }
         httpentity.setContent(content);
-        assertEquals(content, httpentity.getContent());
+        Assert.assertEquals(content, httpentity.getContent());
 
         httpentity.setContent(null);
         try {
             httpentity.getContent();
-            fail("IllegalStateException should have been thrown");
+            Assert.fail("IllegalStateException should have been thrown");
         } catch (IllegalStateException ex) {
             // expected
         }
     }
 
+    @Test
     public void testWriteTo() throws Exception {
         byte[] bytes = "Message content".getBytes(HTTP.US_ASCII);
         InputStream content = new ByteArrayInputStream(bytes);
@@ -89,23 +88,23 @@ public class TestBasicHttpEntity extends
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         httpentity.writeTo(out);
         byte[] bytes2 = out.toByteArray();
-        assertNotNull(bytes2);
-        assertEquals(bytes.length, bytes2.length);
+        Assert.assertNotNull(bytes2);
+        Assert.assertEquals(bytes.length, bytes2.length);
         for (int i = 0; i < bytes.length; i++) {
-            assertEquals(bytes[i], bytes2[i]);
+            Assert.assertEquals(bytes[i], bytes2[i]);
         }
         httpentity.setContent(null);
         out = new ByteArrayOutputStream();
         try {
             httpentity.writeTo(out);
-            fail("IllegalStateException should have been thrown");
+            Assert.fail("IllegalStateException should have been thrown");
         } catch (IllegalStateException ex) {
             // expected
         }
 
         try {
             httpentity.writeTo(null);
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestBufferedHttpEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestBufferedHttpEntity.java?rev=1100965&r1=1100964&r2=1100965&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestBufferedHttpEntity.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestBufferedHttpEntity.java Mon May  9 11:26:57 2011
@@ -30,58 +30,58 @@ package org.apache.http.entity;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 
-import junit.framework.TestCase;
-
 import org.apache.http.protocol.HTTP;
+import org.junit.Assert;
+import org.junit.Test;
 
 /**
  * Unit tests for {@link BufferedHttpEntity}.
  *
  */
-public class TestBufferedHttpEntity extends TestCase {
-
-    public TestBufferedHttpEntity(String testName) {
-        super(testName);
-    }
+public class TestBufferedHttpEntity {
 
+    @Test
     public void testBufferingEntity() throws Exception {
         byte[] bytes = "Message content".getBytes(HTTP.US_ASCII);
         InputStreamEntity httpentity = new InputStreamEntity(new ByteArrayInputStream(bytes), -1);
         BufferedHttpEntity bufentity = new BufferedHttpEntity(httpentity);
-        assertEquals(bytes.length, bufentity.getContentLength());
-        assertTrue(bufentity.isRepeatable());
-        assertFalse(bufentity.isChunked());
-        assertFalse(bufentity.isStreaming());
+        Assert.assertEquals(bytes.length, bufentity.getContentLength());
+        Assert.assertTrue(bufentity.isRepeatable());
+        Assert.assertFalse(bufentity.isChunked());
+        Assert.assertFalse(bufentity.isStreaming());
 
         // test if we can obtain contain multiple times
-        assertNotNull(bufentity.getContent ());
-        assertNotNull(bufentity.getContent ());
+        Assert.assertNotNull(bufentity.getContent ());
+        Assert.assertNotNull(bufentity.getContent ());
     }
 
+    @Test
     public void testWrappingEntity() throws Exception {
         byte[] bytes = "Message content".getBytes(HTTP.US_ASCII);
         ByteArrayEntity httpentity = new ByteArrayEntity(bytes);
         httpentity.setChunked(true);
         BufferedHttpEntity bufentity = new BufferedHttpEntity(httpentity);
-        assertEquals(bytes.length, bufentity.getContentLength());
-        assertTrue(bufentity.isRepeatable());
-        assertTrue(bufentity.isChunked());
-        assertFalse(bufentity.isStreaming());
+        Assert.assertEquals(bytes.length, bufentity.getContentLength());
+        Assert.assertTrue(bufentity.isRepeatable());
+        Assert.assertTrue(bufentity.isChunked());
+        Assert.assertFalse(bufentity.isStreaming());
 
         // test if we can obtain contain multiple times
-        assertNotNull(bufentity.getContent ());
-        assertNotNull(bufentity.getContent ());
+        Assert.assertNotNull(bufentity.getContent ());
+        Assert.assertNotNull(bufentity.getContent ());
     }
 
+    @Test
     public void testIllegalConstructor() throws Exception {
         try {
             new BufferedHttpEntity(null);
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
     }
 
+    @Test
     public void testWriteToBuffered() throws Exception {
         byte[] bytes = "Message content".getBytes(HTTP.US_ASCII);
         InputStreamEntity httpentity = new InputStreamEntity(new ByteArrayInputStream(bytes), -1);
@@ -90,29 +90,30 @@ public class TestBufferedHttpEntity exte
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         bufentity.writeTo(out);
         byte[] bytes2 = out.toByteArray();
-        assertNotNull(bytes2);
-        assertEquals(bytes.length, bytes2.length);
+        Assert.assertNotNull(bytes2);
+        Assert.assertEquals(bytes.length, bytes2.length);
         for (int i = 0; i < bytes.length; i++) {
-            assertEquals(bytes[i], bytes2[i]);
+            Assert.assertEquals(bytes[i], bytes2[i]);
         }
 
         out = new ByteArrayOutputStream();
         bufentity.writeTo(out);
         bytes2 = out.toByteArray();
-        assertNotNull(bytes2);
-        assertEquals(bytes.length, bytes2.length);
+        Assert.assertNotNull(bytes2);
+        Assert.assertEquals(bytes.length, bytes2.length);
         for (int i = 0; i < bytes.length; i++) {
-            assertEquals(bytes[i], bytes2[i]);
+            Assert.assertEquals(bytes[i], bytes2[i]);
         }
 
         try {
             bufentity.writeTo(null);
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
     }
 
+    @Test
     public void testWriteToWrapped() throws Exception {
         byte[] bytes = "Message content".getBytes(HTTP.US_ASCII);
         ByteArrayEntity httpentity = new ByteArrayEntity(bytes);
@@ -121,24 +122,24 @@ public class TestBufferedHttpEntity exte
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         bufentity.writeTo(out);
         byte[] bytes2 = out.toByteArray();
-        assertNotNull(bytes2);
-        assertEquals(bytes.length, bytes2.length);
+        Assert.assertNotNull(bytes2);
+        Assert.assertEquals(bytes.length, bytes2.length);
         for (int i = 0; i < bytes.length; i++) {
-            assertEquals(bytes[i], bytes2[i]);
+            Assert.assertEquals(bytes[i], bytes2[i]);
         }
 
         out = new ByteArrayOutputStream();
         bufentity.writeTo(out);
         bytes2 = out.toByteArray();
-        assertNotNull(bytes2);
-        assertEquals(bytes.length, bytes2.length);
+        Assert.assertNotNull(bytes2);
+        Assert.assertEquals(bytes.length, bytes2.length);
         for (int i = 0; i < bytes.length; i++) {
-            assertEquals(bytes[i], bytes2[i]);
+            Assert.assertEquals(bytes[i], bytes2[i]);
         }
 
         try {
             bufentity.writeTo(null);
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestByteArrayEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestByteArrayEntity.java?rev=1100965&r1=1100964&r2=1100965&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestByteArrayEntity.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestByteArrayEntity.java Mon May  9 11:26:57 2011
@@ -29,39 +29,38 @@ package org.apache.http.entity;
 
 import java.io.ByteArrayOutputStream;
 
-import junit.framework.TestCase;
-
 import org.apache.http.protocol.HTTP;
+import org.junit.Assert;
+import org.junit.Test;
 
 /**
  * Unit tests for {@link ByteArrayEntity}.
  *
  */
-public class TestByteArrayEntity extends TestCase {
-
-    public TestByteArrayEntity(String testName) {
-        super(testName);
-    }
+public class TestByteArrayEntity {
 
+    @Test
     public void testBasics() throws Exception {
         byte[] bytes = "Message content".getBytes(HTTP.US_ASCII);
         ByteArrayEntity httpentity = new ByteArrayEntity(bytes);
 
-        assertEquals(bytes.length, httpentity.getContentLength());
-        assertNotNull(httpentity.getContent());
-        assertTrue(httpentity.isRepeatable());
-        assertFalse(httpentity.isStreaming());
+        Assert.assertEquals(bytes.length, httpentity.getContentLength());
+        Assert.assertNotNull(httpentity.getContent());
+        Assert.assertTrue(httpentity.isRepeatable());
+        Assert.assertFalse(httpentity.isStreaming());
     }
 
+    @Test
     public void testIllegalConstructor() throws Exception {
         try {
             new ByteArrayEntity(null);
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
     }
 
+    @Test
     public void testWriteTo() throws Exception {
         byte[] bytes = "Message content".getBytes(HTTP.US_ASCII);
         ByteArrayEntity httpentity = new ByteArrayEntity(bytes);
@@ -69,24 +68,24 @@ public class TestByteArrayEntity extends
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         httpentity.writeTo(out);
         byte[] bytes2 = out.toByteArray();
-        assertNotNull(bytes2);
-        assertEquals(bytes.length, bytes2.length);
+        Assert.assertNotNull(bytes2);
+        Assert.assertEquals(bytes.length, bytes2.length);
         for (int i = 0; i < bytes.length; i++) {
-            assertEquals(bytes[i], bytes2[i]);
+            Assert.assertEquals(bytes[i], bytes2[i]);
         }
 
         out = new ByteArrayOutputStream();
         httpentity.writeTo(out);
         bytes2 = out.toByteArray();
-        assertNotNull(bytes2);
-        assertEquals(bytes.length, bytes2.length);
+        Assert.assertNotNull(bytes2);
+        Assert.assertEquals(bytes.length, bytes2.length);
         for (int i = 0; i < bytes.length; i++) {
-            assertEquals(bytes[i], bytes2[i]);
+            Assert.assertEquals(bytes[i], bytes2[i]);
         }
 
         try {
             httpentity.writeTo(null);
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestEntityTemplate.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestEntityTemplate.java?rev=1100965&r1=1100964&r2=1100965&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestEntityTemplate.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestEntityTemplate.java Mon May  9 11:26:57 2011
@@ -31,20 +31,17 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 
-import junit.framework.TestCase;
-
 import org.apache.http.HttpEntity;
+import org.junit.Assert;
+import org.junit.Test;
 
 /**
  * Unit tests for {@link EntityTemplate}.
  *
  */
-public class TestEntityTemplate extends TestCase {
-
-    public TestEntityTemplate(String testName) {
-        super(testName);
-    }
+public class TestEntityTemplate {
 
+    @Test
     public void testBasics() throws Exception {
 
         HttpEntity httpentity = new EntityTemplate(new ContentProducer() {
@@ -55,20 +52,22 @@ public class TestEntityTemplate extends 
 
         });
 
-        assertEquals(-1, httpentity.getContentLength());
-        assertTrue(httpentity.isRepeatable());
-        assertFalse(httpentity.isStreaming());
+        Assert.assertEquals(-1, httpentity.getContentLength());
+        Assert.assertTrue(httpentity.isRepeatable());
+        Assert.assertFalse(httpentity.isStreaming());
     }
 
+    @Test
     public void testIllegalConstructor() throws Exception {
         try {
             new EntityTemplate(null);
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
     }
 
+    @Test
     public void testWriteTo() throws Exception {
         HttpEntity httpentity = new EntityTemplate(new ContentProducer() {
 
@@ -81,17 +80,18 @@ public class TestEntityTemplate extends 
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         httpentity.writeTo(out);
         byte[] bytes2 = out.toByteArray();
-        assertNotNull(bytes2);
-        assertEquals(1, bytes2.length);
+        Assert.assertNotNull(bytes2);
+        Assert.assertEquals(1, bytes2.length);
 
         try {
             httpentity.writeTo(null);
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
     }
 
+    @Test
     public void testgetContent() throws Exception {
         HttpEntity httpentity = new EntityTemplate(new ContentProducer() {
 
@@ -102,7 +102,7 @@ public class TestEntityTemplate extends 
         });
         try {
             httpentity.getContent();
-            fail("UnsupportedOperationException should have been thrown");
+            Assert.fail("UnsupportedOperationException should have been thrown");
         } catch (UnsupportedOperationException ex) {
             // expected
         }

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestFileEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestFileEntity.java?rev=1100965&r1=1100964&r2=1100965&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestFileEntity.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestFileEntity.java Mon May  9 11:26:57 2011
@@ -32,45 +32,44 @@ import java.io.File;
 import java.io.FileOutputStream;
 import java.io.InputStream;
 
-import junit.framework.TestCase;
-
 import org.apache.http.protocol.HTTP;
+import org.junit.Assert;
+import org.junit.Test;
 
 /**
  * Unit tests for {@link FileEntity}.
  *
  */
-public class TestFileEntity extends TestCase {
-
-    public TestFileEntity(String testName) {
-        super(testName);
-    }
+public class TestFileEntity {
 
+    @Test
     public void testBasics() throws Exception {
         File tmpfile = File.createTempFile("testfile", ".txt");
         tmpfile.deleteOnExit();
         FileEntity httpentity = new FileEntity(tmpfile, HTTP.ISO_8859_1);
 
-        assertEquals(tmpfile.length(), httpentity.getContentLength());
+        Assert.assertEquals(tmpfile.length(), httpentity.getContentLength());
         final InputStream content = httpentity.getContent();
-        assertNotNull(content);
+        Assert.assertNotNull(content);
         content.close();
-        assertTrue(httpentity.isRepeatable());
-        assertFalse(httpentity.isStreaming());
+        Assert.assertTrue(httpentity.isRepeatable());
+        Assert.assertFalse(httpentity.isStreaming());
         if (!tmpfile.delete()){
-            fail("Failed to delete: "+tmpfile);
+            Assert.fail("Failed to delete: "+tmpfile);
         }
     }
 
+    @Test
     public void testIllegalConstructor() throws Exception {
         try {
             new FileEntity(null, null);
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
     }
 
+    @Test
     public void testWriteTo() throws Exception {
         File tmpfile = File.createTempFile("testfile", ".txt");
         tmpfile.deleteOnExit();
@@ -87,18 +86,18 @@ public class TestFileEntity extends Test
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         httpentity.writeTo(out);
         byte[] bytes = out.toByteArray();
-        assertNotNull(bytes);
-        assertEquals(tmpfile.length(), bytes.length);
+        Assert.assertNotNull(bytes);
+        Assert.assertEquals(tmpfile.length(), bytes.length);
         for (int i = 0; i < 4; i++) {
-            assertEquals(i, bytes[i]);
+            Assert.assertEquals(i, bytes[i]);
         }
         if (!tmpfile.delete()){
-            fail("Failed to delete: "+tmpfile);
+            Assert.fail("Failed to delete: "+tmpfile);
         }
 
         try {
             httpentity.writeTo(null);
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestHttpEntityWrapper.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestHttpEntityWrapper.java?rev=1100965&r1=1100964&r2=1100965&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestHttpEntityWrapper.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestHttpEntityWrapper.java Mon May  9 11:26:57 2011
@@ -29,21 +29,18 @@ package org.apache.http.entity;
 
 import java.io.ByteArrayOutputStream;
 
-import junit.framework.TestCase;
-
 import org.apache.http.protocol.HTTP;
 import org.apache.http.util.EntityUtils;
+import org.junit.Assert;
+import org.junit.Test;
 
 /**
  * Unit tests for {@link HttpEntityWrapper}.
  *
  */
-public class TestHttpEntityWrapper extends TestCase {
-
-    public TestHttpEntityWrapper(String testName) {
-        super(testName);
-    }
+public class TestHttpEntityWrapper {
 
+    @Test
     public void testBasics() throws Exception {
         String s = "Message content";
         StringEntity httpentity = new StringEntity(s, HTTP.ISO_8859_1);
@@ -51,24 +48,26 @@ public class TestHttpEntityWrapper exten
         httpentity.setContentEncoding(HTTP.IDENTITY_CODING);
         HttpEntityWrapper wrapped = new HttpEntityWrapper(httpentity);
 
-        assertEquals(httpentity.getContentLength(), wrapped.getContentLength());
-        assertEquals(httpentity.getContentType(), wrapped.getContentType());
-        assertEquals(httpentity.getContentEncoding(), wrapped.getContentEncoding());
-        assertEquals(httpentity.isChunked(), wrapped.isChunked());
-        assertEquals(httpentity.isRepeatable(), wrapped.isRepeatable());
-        assertEquals(httpentity.isStreaming(), wrapped.isStreaming());
-        assertNotNull(wrapped.getContent());
+        Assert.assertEquals(httpentity.getContentLength(), wrapped.getContentLength());
+        Assert.assertEquals(httpentity.getContentType(), wrapped.getContentType());
+        Assert.assertEquals(httpentity.getContentEncoding(), wrapped.getContentEncoding());
+        Assert.assertEquals(httpentity.isChunked(), wrapped.isChunked());
+        Assert.assertEquals(httpentity.isRepeatable(), wrapped.isRepeatable());
+        Assert.assertEquals(httpentity.isStreaming(), wrapped.isStreaming());
+        Assert.assertNotNull(wrapped.getContent());
     }
 
+    @Test
     public void testIllegalConstructor() throws Exception {
         try {
             new HttpEntityWrapper(null);
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
     }
 
+    @Test
     public void testWriteTo() throws Exception {
         String s = "Message content";
         byte[] bytes = s.getBytes(HTTP.ISO_8859_1);
@@ -78,29 +77,30 @@ public class TestHttpEntityWrapper exten
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         wrapped.writeTo(out);
         byte[] bytes2 = out.toByteArray();
-        assertNotNull(bytes2);
-        assertEquals(bytes.length, bytes2.length);
+        Assert.assertNotNull(bytes2);
+        Assert.assertEquals(bytes.length, bytes2.length);
         for (int i = 0; i < bytes.length; i++) {
-            assertEquals(bytes[i], bytes2[i]);
+            Assert.assertEquals(bytes[i], bytes2[i]);
         }
 
         out = new ByteArrayOutputStream();
         wrapped.writeTo(out);
         bytes2 = out.toByteArray();
-        assertNotNull(bytes2);
-        assertEquals(bytes.length, bytes2.length);
+        Assert.assertNotNull(bytes2);
+        Assert.assertEquals(bytes.length, bytes2.length);
         for (int i = 0; i < bytes.length; i++) {
-            assertEquals(bytes[i], bytes2[i]);
+            Assert.assertEquals(bytes[i], bytes2[i]);
         }
 
         try {
             wrapped.writeTo(null);
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
     }
 
+    @Test
     public void testConsumeContent() throws Exception {
         String s = "Message content";
         StringEntity httpentity = new StringEntity(s);

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestInputStreamEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestInputStreamEntity.java?rev=1100965&r1=1100964&r2=1100965&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestInputStreamEntity.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestInputStreamEntity.java Mon May  9 11:26:57 2011
@@ -31,41 +31,40 @@ import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
 
-import junit.framework.TestCase;
-
 import org.apache.http.protocol.HTTP;
+import org.junit.Assert;
+import org.junit.Test;
 
 /**
  * Unit tests for {@link InputStreamEntity}.
  *
  */
-public class TestInputStreamEntity extends TestCase {
-
-    public TestInputStreamEntity(String testName) {
-        super(testName);
-    }
+public class TestInputStreamEntity {
 
+    @Test
     public void testBasics() throws Exception {
         byte[] bytes = "Message content".getBytes(HTTP.ISO_8859_1);
         InputStream instream = new ByteArrayInputStream(bytes);
         InputStreamEntity httpentity = new InputStreamEntity(instream, bytes.length);
 
-        assertEquals(bytes.length, httpentity.getContentLength());
-        assertEquals(instream, httpentity.getContent());
-        assertNotNull(httpentity.getContent());
-        assertFalse(httpentity.isRepeatable());
-        assertTrue(httpentity.isStreaming());
+        Assert.assertEquals(bytes.length, httpentity.getContentLength());
+        Assert.assertEquals(instream, httpentity.getContent());
+        Assert.assertNotNull(httpentity.getContent());
+        Assert.assertFalse(httpentity.isRepeatable());
+        Assert.assertTrue(httpentity.isStreaming());
     }
 
+    @Test
     public void testIllegalConstructor() throws Exception {
         try {
             new InputStreamEntity(null, 0);
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
     }
 
+    @Test
     public void testWriteTo() throws Exception {
         byte[] bytes = "Message content".getBytes(HTTP.ISO_8859_1);
         InputStream instream = new ByteArrayInputStream(bytes);
@@ -74,30 +73,30 @@ public class TestInputStreamEntity exten
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         httpentity.writeTo(out);
         byte[] bytes2 = out.toByteArray();
-        assertNotNull(bytes2);
-        assertEquals(7, bytes2.length);
+        Assert.assertNotNull(bytes2);
+        Assert.assertEquals(7, bytes2.length);
         String s = new String(bytes2, HTTP.ISO_8859_1);
-        assertEquals("Message", s);
+        Assert.assertEquals("Message", s);
 
         instream = new ByteArrayInputStream(bytes);
         httpentity = new InputStreamEntity(instream, 20);
         out = new ByteArrayOutputStream();
         httpentity.writeTo(out);
         bytes2 = out.toByteArray();
-        assertNotNull(bytes2);
-        assertEquals(bytes.length, bytes2.length);
+        Assert.assertNotNull(bytes2);
+        Assert.assertEquals(bytes.length, bytes2.length);
 
         instream = new ByteArrayInputStream(bytes);
         httpentity = new InputStreamEntity(instream, -1);
         out = new ByteArrayOutputStream();
         httpentity.writeTo(out);
         bytes2 = out.toByteArray();
-        assertNotNull(bytes2);
-        assertEquals(bytes.length, bytes2.length);
+        Assert.assertNotNull(bytes2);
+        Assert.assertEquals(bytes.length, bytes2.length);
 
         try {
             httpentity.writeTo(null);
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }



Mime
View raw message