hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1100965 [5/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/src/test/java/org/apache/http/impl/io/TestChunkCoding.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestChunkCoding.java?rev=1100965&r1=1100964&r2=1100965&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestChunkCoding.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestChunkCoding.java Mon May  9 11:26:57 2011
@@ -33,8 +33,6 @@ import java.io.InputStream;
 import java.io.InterruptedIOException;
 import java.io.OutputStream;
 
-import junit.framework.TestCase;
-
 import org.apache.http.Header;
 import org.apache.http.MalformedChunkCodingException;
 import org.apache.http.io.SessionInputBuffer;
@@ -42,19 +40,18 @@ import org.apache.http.mockup.SessionInp
 import org.apache.http.mockup.SessionOutputBufferMockup;
 import org.apache.http.mockup.TimeoutByteArrayInputStream;
 import org.apache.http.util.EncodingUtils;
+import org.junit.Assert;
+import org.junit.Test;
 
-public class TestChunkCoding extends TestCase {
+public class TestChunkCoding {
 
     private static final String CONTENT_CHARSET = "ISO-8859-1";
 
-    public TestChunkCoding(String testName) {
-        super(testName);
-    }
-
+    @Test
     public void testConstructors() throws Exception {
         try {
             new ChunkedInputStream((SessionInputBuffer)null);
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
@@ -69,6 +66,7 @@ public class TestChunkCoding extends Tes
         = "123456789012345612345";
 
     // Test for when buffer is larger than chunk size
+    @Test
     public void testChunkedInputStreamLargeBuffer() throws IOException {
         ChunkedInputStream in = new ChunkedInputStream(
                 new SessionInputBufferMockup(
@@ -79,24 +77,25 @@ public class TestChunkCoding extends Tes
         while ((len = in.read(buffer)) > 0) {
             out.write(buffer, 0, len);
         }
-        assertEquals(-1, in.read(buffer));
-        assertEquals(-1, in.read(buffer));
+        Assert.assertEquals(-1, in.read(buffer));
+        Assert.assertEquals(-1, in.read(buffer));
 
         in.close();
 
         String result = EncodingUtils.getString(out.toByteArray(), CONTENT_CHARSET);
-        assertEquals(result, CHUNKED_RESULT);
+        Assert.assertEquals(result, CHUNKED_RESULT);
 
         Header[] footers = in.getFooters();
-        assertNotNull(footers);
-        assertEquals(2, footers.length);
-        assertEquals("Footer1", footers[0].getName());
-        assertEquals("abcde", footers[0].getValue());
-        assertEquals("Footer2", footers[1].getName());
-        assertEquals("fghij", footers[1].getValue());
+        Assert.assertNotNull(footers);
+        Assert.assertEquals(2, footers.length);
+        Assert.assertEquals("Footer1", footers[0].getName());
+        Assert.assertEquals("abcde", footers[0].getValue());
+        Assert.assertEquals("Footer2", footers[1].getName());
+        Assert.assertEquals("fghij", footers[1].getValue());
     }
 
     //Test for when buffer is smaller than chunk size.
+    @Test
     public void testChunkedInputStreamSmallBuffer() throws IOException {
         ChunkedInputStream in = new ChunkedInputStream(
                 new SessionInputBufferMockup(
@@ -108,22 +107,23 @@ public class TestChunkCoding extends Tes
         while ((len = in.read(buffer)) > 0) {
             out.write(buffer, 0, len);
         }
-        assertEquals(-1, in.read(buffer));
-        assertEquals(-1, in.read(buffer));
+        Assert.assertEquals(-1, in.read(buffer));
+        Assert.assertEquals(-1, in.read(buffer));
 
         in.close();
 
         EncodingUtils.getString(out.toByteArray(), CONTENT_CHARSET);
         Header[] footers = in.getFooters();
-        assertNotNull(footers);
-        assertEquals(2, footers.length);
-        assertEquals("Footer1", footers[0].getName());
-        assertEquals("abcde", footers[0].getValue());
-        assertEquals("Footer2", footers[1].getName());
-        assertEquals("fghij", footers[1].getValue());
+        Assert.assertNotNull(footers);
+        Assert.assertEquals(2, footers.length);
+        Assert.assertEquals("Footer1", footers[0].getName());
+        Assert.assertEquals("abcde", footers[0].getValue());
+        Assert.assertEquals("Footer2", footers[1].getName());
+        Assert.assertEquals("fghij", footers[1].getValue());
     }
 
     // One byte read
+    @Test
     public void testChunkedInputStreamOneByteRead() throws IOException {
         String s = "5\r\n01234\r\n5\r\n56789\r\n0\r\n";
         ChunkedInputStream in = new ChunkedInputStream(
@@ -132,25 +132,27 @@ public class TestChunkCoding extends Tes
         int ch;
         int i = '0';
         while ((ch = in.read()) != -1) {
-            assertEquals(i, ch);
+            Assert.assertEquals(i, ch);
             i++;
         }
-        assertEquals(-1, in.read());
-        assertEquals(-1, in.read());
+        Assert.assertEquals(-1, in.read());
+        Assert.assertEquals(-1, in.read());
 
         in.close();
     }
 
+    @Test
     public void testAvailable() throws IOException {
         String s = "5\r\n12345\r\n0\r\n";
         ChunkedInputStream in = new ChunkedInputStream(
                 new SessionInputBufferMockup(
                         EncodingUtils.getBytes(s, CONTENT_CHARSET)));
-        assertEquals(0, in.available());
+        Assert.assertEquals(0, in.available());
         in.read();
-        assertEquals(4, in.available());
+        Assert.assertEquals(4, in.available());
     }
 
+    @Test
     public void testChunkedInputStreamClose() throws IOException {
         String s = "5\r\n01234\r\n5\r\n56789\r\n0\r\n";
         ChunkedInputStream in = new ChunkedInputStream(
@@ -160,25 +162,26 @@ public class TestChunkCoding extends Tes
         in.close();
         try {
             in.read();
-            fail("IOException should have been thrown");
+            Assert.fail("IOException should have been thrown");
         } catch (IOException ex) {
             // expected
         }
         byte[] tmp = new byte[10];
         try {
             in.read(tmp);
-            fail("IOException should have been thrown");
+            Assert.fail("IOException should have been thrown");
         } catch (IOException ex) {
             // expected
         }
         try {
             in.read(tmp, 0, tmp.length);
-            fail("IOException should have been thrown");
+            Assert.fail("IOException should have been thrown");
         } catch (IOException ex) {
             // expected
         }
     }
 
+    @Test
     public void testChunkedOutputStreamClose() throws IOException {
         ChunkedOutputStream out = new ChunkedOutputStream(
                 new SessionOutputBufferMockup());
@@ -186,30 +189,32 @@ public class TestChunkCoding extends Tes
         out.close();
         try {
             out.write(new byte[] {1,2,3});
-            fail("IOException should have been thrown");
+            Assert.fail("IOException should have been thrown");
         } catch (IOException ex) {
             // expected
         }
         try {
             out.write(1);
-            fail("IOException should have been thrown");
+            Assert.fail("IOException should have been thrown");
         } catch (IOException ex) {
             // expected
         }
     }
 
     // Missing closing chunk
+    @Test
     public void testChunkedInputStreamNoClosingChunk() throws IOException {
         String s = "5\r\n01234\r\n";
         ChunkedInputStream in = new ChunkedInputStream(
                 new SessionInputBufferMockup(
                         EncodingUtils.getBytes(s, CONTENT_CHARSET)));
         byte[] tmp = new byte[5];
-        assertEquals(5, in.read(tmp));
-        assertEquals(-1, in.read());
+        Assert.assertEquals(5, in.read(tmp));
+        Assert.assertEquals(-1, in.read());
     }
 
     // Missing \r\n at the end of the first chunk
+    @Test
     public void testCorruptChunkedInputStreamMissingCRLF() throws IOException {
         String s = "5\r\n012345\r\n56789\r\n0\r\n";
         InputStream in = new ChunkedInputStream(
@@ -222,13 +227,14 @@ public class TestChunkCoding extends Tes
             while ((len = in.read(buffer)) > 0) {
                 out.write(buffer, 0, len);
             }
-            fail("MalformedChunkCodingException should have been thrown");
+            Assert.fail("MalformedChunkCodingException should have been thrown");
         } catch(MalformedChunkCodingException e) {
             /* expected exception */
         }
     }
 
     // Missing LF
+    @Test
     public void testCorruptChunkedInputStreamMissingLF() throws IOException {
         String s = "5\r01234\r\n5\r\n56789\r\n0\r\n";
         InputStream in = new ChunkedInputStream(
@@ -236,13 +242,14 @@ public class TestChunkCoding extends Tes
                         EncodingUtils.getBytes(s, CONTENT_CHARSET)));
         try {
             in.read();
-            fail("MalformedChunkCodingException should have been thrown");
+            Assert.fail("MalformedChunkCodingException should have been thrown");
         } catch(MalformedChunkCodingException e) {
             /* expected exception */
         }
     }
 
     // Invalid chunk size
+    @Test
     public void testCorruptChunkedInputStreamInvalidSize() throws IOException {
         String s = "whatever\r\n01234\r\n5\r\n56789\r\n0\r\n";
         InputStream in = new ChunkedInputStream(
@@ -250,13 +257,14 @@ public class TestChunkCoding extends Tes
                         EncodingUtils.getBytes(s, CONTENT_CHARSET)));
         try {
             in.read();
-            fail("MalformedChunkCodingException should have been thrown");
+            Assert.fail("MalformedChunkCodingException should have been thrown");
         } catch(MalformedChunkCodingException e) {
             /* expected exception */
         }
     }
 
     // Negative chunk size
+    @Test
     public void testCorruptChunkedInputStreamNegativeSize() throws IOException {
         String s = "-5\r\n01234\r\n5\r\n56789\r\n0\r\n";
         InputStream in = new ChunkedInputStream(
@@ -264,29 +272,31 @@ public class TestChunkCoding extends Tes
                         EncodingUtils.getBytes(s, CONTENT_CHARSET)));
         try {
             in.read();
-            fail("MalformedChunkCodingException should have been thrown");
+            Assert.fail("MalformedChunkCodingException should have been thrown");
         } catch(MalformedChunkCodingException e) {
             /* expected exception */
         }
     }
 
     // Truncated chunk
+    @Test
     public void testCorruptChunkedInputStreamTruncatedChunk() throws IOException {
         String s = "3\r\n12";
         InputStream in = new ChunkedInputStream(
                 new SessionInputBufferMockup(
                         EncodingUtils.getBytes(s, CONTENT_CHARSET)));
         byte[] buffer = new byte[300];
-        assertEquals(2, in.read(buffer));
+        Assert.assertEquals(2, in.read(buffer));
         try {
             in.read(buffer);
-            fail("MalformedChunkCodingException should have been thrown");
+            Assert.fail("MalformedChunkCodingException should have been thrown");
         } catch(MalformedChunkCodingException e) {
             /* expected exception */
         }
     }
 
     // Invalid footer
+    @Test
     public void testCorruptChunkedInputStreamInvalidFooter() throws IOException {
         String s = "1\r\n0\r\n0\r\nstuff\r\n";
         InputStream in = new ChunkedInputStream(
@@ -295,12 +305,13 @@ public class TestChunkCoding extends Tes
         try {
             in.read();
             in.read();
-            fail("MalformedChunkCodingException should have been thrown");
+            Assert.fail("MalformedChunkCodingException should have been thrown");
         } catch(MalformedChunkCodingException e) {
             /* expected exception */
         }
     }
 
+    @Test
     public void testEmptyChunkedInputStream() throws IOException {
         String input = "0\r\n";
         InputStream in = new ChunkedInputStream(
@@ -312,9 +323,10 @@ public class TestChunkCoding extends Tes
         while ((len = in.read(buffer)) > 0) {
             out.write(buffer, 0, len);
         }
-        assertEquals(0, out.size());
+        Assert.assertEquals(0, out.size());
     }
 
+    @Test
     public void testChunkedConsistence() throws IOException {
         String input = "76126;27823abcd;:q38a-\nkjc\rk%1ad\tkh/asdui\r\njkh+?\\suweb";
         ByteArrayOutputStream buffer = new ByteArrayOutputStream();
@@ -336,9 +348,10 @@ public class TestChunkCoding extends Tes
         }
 
         String output = EncodingUtils.getString(result.toByteArray(), CONTENT_CHARSET);
-        assertEquals(input, output);
+        Assert.assertEquals(input, output);
     }
 
+    @Test
     public void testChunkedOutputStream() throws IOException {
         SessionOutputBufferMockup buffer = new SessionOutputBufferMockup();
         ChunkedOutputStream out = new ChunkedOutputStream(buffer, 2);
@@ -351,28 +364,29 @@ public class TestChunkCoding extends Tes
 
         byte [] rawdata =  buffer.getData();
 
-        assertEquals(19, rawdata.length);
-        assertEquals('2', rawdata[0]);
-        assertEquals('\r', rawdata[1]);
-        assertEquals('\n', rawdata[2]);
-        assertEquals('1', rawdata[3]);
-        assertEquals('2', rawdata[4]);
-        assertEquals('\r', rawdata[5]);
-        assertEquals('\n', rawdata[6]);
-        assertEquals('2', rawdata[7]);
-        assertEquals('\r', rawdata[8]);
-        assertEquals('\n', rawdata[9]);
-        assertEquals('3', rawdata[10]);
-        assertEquals('4', rawdata[11]);
-        assertEquals('\r', rawdata[12]);
-        assertEquals('\n', rawdata[13]);
-        assertEquals('0', rawdata[14]);
-        assertEquals('\r', rawdata[15]);
-        assertEquals('\n', rawdata[16]);
-        assertEquals('\r', rawdata[17]);
-        assertEquals('\n', rawdata[18]);
+        Assert.assertEquals(19, rawdata.length);
+        Assert.assertEquals('2', rawdata[0]);
+        Assert.assertEquals('\r', rawdata[1]);
+        Assert.assertEquals('\n', rawdata[2]);
+        Assert.assertEquals('1', rawdata[3]);
+        Assert.assertEquals('2', rawdata[4]);
+        Assert.assertEquals('\r', rawdata[5]);
+        Assert.assertEquals('\n', rawdata[6]);
+        Assert.assertEquals('2', rawdata[7]);
+        Assert.assertEquals('\r', rawdata[8]);
+        Assert.assertEquals('\n', rawdata[9]);
+        Assert.assertEquals('3', rawdata[10]);
+        Assert.assertEquals('4', rawdata[11]);
+        Assert.assertEquals('\r', rawdata[12]);
+        Assert.assertEquals('\n', rawdata[13]);
+        Assert.assertEquals('0', rawdata[14]);
+        Assert.assertEquals('\r', rawdata[15]);
+        Assert.assertEquals('\n', rawdata[16]);
+        Assert.assertEquals('\r', rawdata[17]);
+        Assert.assertEquals('\n', rawdata[18]);
     }
 
+    @Test
     public void testChunkedOutputStreamLargeChunk() throws IOException {
         SessionOutputBufferMockup buffer = new SessionOutputBufferMockup();
         ChunkedOutputStream out = new ChunkedOutputStream(buffer, 2);
@@ -382,23 +396,24 @@ public class TestChunkCoding extends Tes
 
         byte [] rawdata =  buffer.getData();
 
-        assertEquals(14, rawdata.length);
-        assertEquals('4', rawdata[0]);
-        assertEquals('\r', rawdata[1]);
-        assertEquals('\n', rawdata[2]);
-        assertEquals('1', rawdata[3]);
-        assertEquals('2', rawdata[4]);
-        assertEquals('3', rawdata[5]);
-        assertEquals('4', rawdata[6]);
-        assertEquals('\r', rawdata[7]);
-        assertEquals('\n', rawdata[8]);
-        assertEquals('0', rawdata[9]);
-        assertEquals('\r', rawdata[10]);
-        assertEquals('\n', rawdata[11]);
-        assertEquals('\r', rawdata[12]);
-        assertEquals('\n', rawdata[13]);
+        Assert.assertEquals(14, rawdata.length);
+        Assert.assertEquals('4', rawdata[0]);
+        Assert.assertEquals('\r', rawdata[1]);
+        Assert.assertEquals('\n', rawdata[2]);
+        Assert.assertEquals('1', rawdata[3]);
+        Assert.assertEquals('2', rawdata[4]);
+        Assert.assertEquals('3', rawdata[5]);
+        Assert.assertEquals('4', rawdata[6]);
+        Assert.assertEquals('\r', rawdata[7]);
+        Assert.assertEquals('\n', rawdata[8]);
+        Assert.assertEquals('0', rawdata[9]);
+        Assert.assertEquals('\r', rawdata[10]);
+        Assert.assertEquals('\n', rawdata[11]);
+        Assert.assertEquals('\r', rawdata[12]);
+        Assert.assertEquals('\n', rawdata[13]);
     }
 
+    @Test
     public void testChunkedOutputStreamSmallChunk() throws IOException {
         ByteArrayOutputStream buffer = new ByteArrayOutputStream();
         ChunkedOutputStream out = new ChunkedOutputStream(
@@ -409,20 +424,21 @@ public class TestChunkCoding extends Tes
 
         byte [] rawdata =  buffer.toByteArray();
 
-        assertEquals(11, rawdata.length);
-        assertEquals('1', rawdata[0]);
-        assertEquals('\r', rawdata[1]);
-        assertEquals('\n', rawdata[2]);
-        assertEquals('1', rawdata[3]);
-        assertEquals('\r', rawdata[4]);
-        assertEquals('\n', rawdata[5]);
-        assertEquals('0', rawdata[6]);
-        assertEquals('\r', rawdata[7]);
-        assertEquals('\n', rawdata[8]);
-        assertEquals('\r', rawdata[9]);
-        assertEquals('\n', rawdata[10]);
+        Assert.assertEquals(11, rawdata.length);
+        Assert.assertEquals('1', rawdata[0]);
+        Assert.assertEquals('\r', rawdata[1]);
+        Assert.assertEquals('\n', rawdata[2]);
+        Assert.assertEquals('1', rawdata[3]);
+        Assert.assertEquals('\r', rawdata[4]);
+        Assert.assertEquals('\n', rawdata[5]);
+        Assert.assertEquals('0', rawdata[6]);
+        Assert.assertEquals('\r', rawdata[7]);
+        Assert.assertEquals('\n', rawdata[8]);
+        Assert.assertEquals('\r', rawdata[9]);
+        Assert.assertEquals('\n', rawdata[10]);
     }
 
+    @Test
     public void testResumeOnSocketTimeoutInData() throws IOException {
         String s = "5\r\n01234\r\n5\r\n5\0006789\r\na\r\n0123\000456789\r\n0\r\n";
         SessionInputBuffer sessbuf = new SessionInputBufferMockup(
@@ -445,10 +461,11 @@ public class TestChunkCoding extends Tes
                 timeouts++;
             }
         }
-        assertEquals(20, bytesRead);
-        assertEquals(2, timeouts);
+        Assert.assertEquals(20, bytesRead);
+        Assert.assertEquals(2, timeouts);
     }
 
+    @Test
     public void testResumeOnSocketTimeoutInChunk() throws IOException {
         String s = "5\000\r\000\n\00001234\r\n\0005\r\n56789\r\na\r\n0123456789\r\n\0000\r\n";
         SessionInputBuffer sessbuf = new SessionInputBufferMockup(
@@ -471,8 +488,8 @@ public class TestChunkCoding extends Tes
                 timeouts++;
             }
         }
-        assertEquals(20, bytesRead);
-        assertEquals(5, timeouts);
+        Assert.assertEquals(20, bytesRead);
+        Assert.assertEquals(5, timeouts);
     }
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestContentLengthInputStream.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestContentLengthInputStream.java?rev=1100965&r1=1100964&r2=1100965&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestContentLengthInputStream.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestContentLengthInputStream.java Mon May  9 11:26:57 2011
@@ -31,35 +31,33 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 
-import junit.framework.TestCase;
-
 import org.apache.http.mockup.SessionInputBufferMockup;
 import org.apache.http.util.EncodingUtils;
+import org.junit.Assert;
+import org.junit.Test;
 
-public class TestContentLengthInputStream extends TestCase {
-
-    public TestContentLengthInputStream(String testName) {
-        super(testName);
-    }
+public class TestContentLengthInputStream {
 
     private static final String CONTENT_CHARSET = "ISO-8859-1";
 
+    @Test
     public void testConstructors() throws Exception {
         new ContentLengthInputStream(new SessionInputBufferMockup(new byte[] {}), 10);
         try {
             new ContentLengthInputStream(null, 10);
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
         try {
             new ContentLengthInputStream(new SessionInputBufferMockup(new byte[] {}), -10);
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
     }
 
+    @Test
     public void testBasics() throws IOException {
         String correct = "1234567890123456";
         InputStream in = new ContentLengthInputStream(new SessionInputBufferMockup(
@@ -73,43 +71,46 @@ public class TestContentLengthInputStrea
         out.write(buffer, 0, len);
 
         String result = EncodingUtils.getString(out.toByteArray(), CONTENT_CHARSET);
-        assertEquals(result, "1234567890");
+        Assert.assertEquals(result, "1234567890");
     }
 
+    @Test
     public void testSkip() throws IOException {
         InputStream in = new ContentLengthInputStream(new SessionInputBufferMockup(new byte[20]), 10L);
-        assertEquals(10, in.skip(10));
-        assertTrue(in.read() == -1);
+        Assert.assertEquals(10, in.skip(10));
+        Assert.assertTrue(in.read() == -1);
 
         in = new ContentLengthInputStream(new SessionInputBufferMockup(new byte[20]), 10L);
         in.read();
-        assertEquals(9, in.skip(10));
-        assertTrue(in.read() == -1);
+        Assert.assertEquals(9, in.skip(10));
+        Assert.assertTrue(in.read() == -1);
 
         in = new ContentLengthInputStream(new SessionInputBufferMockup(new byte[20]), 2L);
         in.read();
         in.read();
-        assertTrue(in.skip(10) <= 0);
-        assertTrue(in.skip(-1) == 0);
-        assertTrue(in.read() == -1);
+        Assert.assertTrue(in.skip(10) <= 0);
+        Assert.assertTrue(in.skip(-1) == 0);
+        Assert.assertTrue(in.read() == -1);
 
         in = new ContentLengthInputStream(new SessionInputBufferMockup(new byte[2]), 4L);
         in.read();
-        assertTrue(in.skip(2) == 1);
+        Assert.assertTrue(in.skip(2) == 1);
 
         in = new ContentLengthInputStream(new SessionInputBufferMockup(new byte[20]), 10L);
-        assertEquals(5,in.skip(5));
-        assertEquals(5, in.read(new byte[20]));
+        Assert.assertEquals(5,in.skip(5));
+        Assert.assertEquals(5, in.read(new byte[20]));
     }
 
+    @Test
     public void testAvailable() throws IOException {
         InputStream in = new ContentLengthInputStream(
                 new SessionInputBufferMockup(new byte[] {1, 2, 3}), 10L);
-        assertEquals(0, in.available());
+        Assert.assertEquals(0, in.available());
         in.read();
-        assertEquals(2, in.available());
+        Assert.assertEquals(2, in.available());
     }
 
+    @Test
     public void testClose() throws IOException {
         String correct = "1234567890123456";
         InputStream in = new ContentLengthInputStream(new SessionInputBufferMockup(
@@ -118,20 +119,20 @@ public class TestContentLengthInputStrea
         in.close();
         try {
             in.read();
-            fail("IOException should have been thrown");
+            Assert.fail("IOException should have been thrown");
         } catch (IOException ex) {
             // expected
         }
         byte[] tmp = new byte[10];
         try {
             in.read(tmp);
-            fail("IOException should have been thrown");
+            Assert.fail("IOException should have been thrown");
         } catch (IOException ex) {
             // expected
         }
         try {
             in.read(tmp, 0, tmp.length);
-            fail("IOException should have been thrown");
+            Assert.fail("IOException should have been thrown");
         } catch (IOException ex) {
             // expected
         }

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestContentLengthOutputStream.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestContentLengthOutputStream.java?rev=1100965&r1=1100964&r2=1100965&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestContentLengthOutputStream.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestContentLengthOutputStream.java Mon May  9 11:26:57 2011
@@ -31,32 +31,30 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 
-import junit.framework.TestCase;
-
 import org.apache.http.mockup.SessionOutputBufferMockup;
+import org.junit.Assert;
+import org.junit.Test;
 
-public class TestContentLengthOutputStream extends TestCase {
-
-    public TestContentLengthOutputStream(String testName) {
-        super(testName);
-    }
+public class TestContentLengthOutputStream {
 
+    @Test
     public void testConstructors() throws Exception {
         new ContentLengthOutputStream(new SessionOutputBufferMockup(), 10L);
         try {
             new ContentLengthOutputStream(null, 10L);
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
         try {
             new ContentLengthOutputStream(new SessionOutputBufferMockup(), -10);
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
     }
 
+    @Test
     public void testBasics() throws Exception {
         ByteArrayOutputStream buffer = new ByteArrayOutputStream();
         SessionOutputBufferMockup datatransmitter = new SessionOutputBufferMockup(buffer);
@@ -73,9 +71,10 @@ public class TestContentLengthOutputStre
         out.flush();
         out.close();
         byte[] data = datatransmitter.getData();
-        assertEquals(15, data.length);
+        Assert.assertEquals(15, data.length);
     }
 
+    @Test
     public void testClose() throws Exception {
         ByteArrayOutputStream buffer = new ByteArrayOutputStream();
         SessionOutputBufferMockup datatransmitter = new SessionOutputBufferMockup(buffer);
@@ -85,13 +84,13 @@ public class TestContentLengthOutputStre
         byte[] tmp = new byte[10];
         try {
             out.write(tmp);
-            fail("IOException should have been thrown");
+            Assert.fail("IOException should have been thrown");
         } catch (IOException ex) {
             // expected
         }
         try {
             out.write(1);
-            fail("IOException should have been thrown");
+            Assert.fail("IOException should have been thrown");
         } catch (IOException ex) {
             // expected
         }

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestIdentityInputStream.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestIdentityInputStream.java?rev=1100965&r1=1100964&r2=1100965&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestIdentityInputStream.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestIdentityInputStream.java Mon May  9 11:26:57 2011
@@ -27,50 +27,46 @@
 
 package org.apache.http.impl.io;
 
-import junit.framework.TestCase;
-
 import org.apache.http.io.SessionInputBuffer;
 import org.apache.http.mockup.SessionInputBufferMockup;
+import org.junit.Assert;
+import org.junit.Test;
 
 /**
  * Simple tests for {@link IdentityInputStream}.
  *
  */
-public class TestIdentityInputStream extends TestCase {
-
-    // ------------------------------------------------------------ Constructor
-    public TestIdentityInputStream(String testName) {
-        super(testName);
-    }
-
-    // ------------------------------------------------------- TestCase Methods
+public class TestIdentityInputStream {
 
+    @Test
     public void testConstructor() throws Exception {
         SessionInputBuffer receiver = new SessionInputBufferMockup(new byte[] {});
         new IdentityInputStream(receiver);
         try {
             new IdentityInputStream(null);
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             //expected
         }
     }
 
+    @Test
     public void testBasicRead() throws Exception {
         byte[] input = new byte[] {'a', 'b', 'c'};
         SessionInputBufferMockup receiver = new SessionInputBufferMockup(input);
         IdentityInputStream instream = new IdentityInputStream(receiver);
         byte[] tmp = new byte[2];
-        assertEquals(2, instream.read(tmp, 0, tmp.length));
-        assertEquals('a', tmp[0]);
-        assertEquals('b', tmp[1]);
-        assertEquals('c', instream.read());
-        assertEquals(-1, instream.read(tmp, 0, tmp.length));
-        assertEquals(-1, instream.read());
-        assertEquals(-1, instream.read(tmp, 0, tmp.length));
-        assertEquals(-1, instream.read());
+        Assert.assertEquals(2, instream.read(tmp, 0, tmp.length));
+        Assert.assertEquals('a', tmp[0]);
+        Assert.assertEquals('b', tmp[1]);
+        Assert.assertEquals('c', instream.read());
+        Assert.assertEquals(-1, instream.read(tmp, 0, tmp.length));
+        Assert.assertEquals(-1, instream.read());
+        Assert.assertEquals(-1, instream.read(tmp, 0, tmp.length));
+        Assert.assertEquals(-1, instream.read());
     }
 
+    @Test
     public void testClosedCondition() throws Exception {
         byte[] input = new byte[] {'a', 'b', 'c'};
         SessionInputBufferMockup receiver = new SessionInputBufferMockup(input);
@@ -79,20 +75,21 @@ public class TestIdentityInputStream ext
         instream.close();
         instream.close();
 
-        assertEquals(0, instream.available());
+        Assert.assertEquals(0, instream.available());
         byte[] tmp = new byte[2];
-        assertEquals(-1, instream.read(tmp, 0, tmp.length));
-        assertEquals(-1, instream.read());
-        assertEquals(-1, instream.read(tmp, 0, tmp.length));
-        assertEquals(-1, instream.read());
+        Assert.assertEquals(-1, instream.read(tmp, 0, tmp.length));
+        Assert.assertEquals(-1, instream.read());
+        Assert.assertEquals(-1, instream.read(tmp, 0, tmp.length));
+        Assert.assertEquals(-1, instream.read());
     }
 
+    @Test
     public void testAvailable() throws Exception {
         byte[] input = new byte[] {'a', 'b', 'c'};
         SessionInputBufferMockup receiver = new SessionInputBufferMockup(input);
         IdentityInputStream instream = new IdentityInputStream(receiver);
         instream.read();
-        assertEquals(2, instream.available());
+        Assert.assertEquals(2, instream.available());
     }
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestIdentityOutputStream.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestIdentityOutputStream.java?rev=1100965&r1=1100964&r2=1100965&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestIdentityOutputStream.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestIdentityOutputStream.java Mon May  9 11:26:57 2011
@@ -31,26 +31,24 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 
-import junit.framework.TestCase;
-
 import org.apache.http.mockup.SessionOutputBufferMockup;
+import org.junit.Assert;
+import org.junit.Test;
 
-public class TestIdentityOutputStream extends TestCase {
-
-    public TestIdentityOutputStream(String testName) {
-        super(testName);
-    }
+public class TestIdentityOutputStream {
 
+    @Test
     public void testConstructors() throws Exception {
         new IdentityOutputStream(new SessionOutputBufferMockup());
         try {
             new IdentityOutputStream(null);
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
     }
 
+    @Test
     public void testBasics() throws Exception {
         ByteArrayOutputStream buffer = new ByteArrayOutputStream();
         SessionOutputBufferMockup datatransmitter = new SessionOutputBufferMockup(buffer);
@@ -63,9 +61,10 @@ public class TestIdentityOutputStream ex
         out.flush();
         out.close();
         byte[] data = datatransmitter.getData();
-        assertEquals(21, data.length);
+        Assert.assertEquals(21, data.length);
     }
 
+    @Test
     public void testClose() throws Exception {
         ByteArrayOutputStream buffer = new ByteArrayOutputStream();
         SessionOutputBufferMockup datatransmitter = new SessionOutputBufferMockup(buffer);
@@ -75,29 +74,31 @@ public class TestIdentityOutputStream ex
         byte[] tmp = new byte[10];
         try {
             out.write(tmp);
-            fail("IOException should have been thrown");
+            Assert.fail("IOException should have been thrown");
         } catch (IOException ex) {
             // expected
         }
         try {
             out.write(1);
-            fail("IOException should have been thrown");
+            Assert.fail("IOException should have been thrown");
         } catch (IOException ex) {
             // expected
         }
     }
 
+    @Test
     public void testConstructor() throws Exception {
         SessionOutputBufferMockup transmitter = new SessionOutputBufferMockup();
         new IdentityOutputStream(transmitter);
         try {
             new IdentityOutputStream(null);
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             //expected
         }
     }
 
+    @Test
     public void testBasicWrite() throws Exception {
         SessionOutputBufferMockup transmitter = new SessionOutputBufferMockup();
         IdentityOutputStream outstream = new IdentityOutputStream(transmitter);
@@ -107,14 +108,15 @@ public class TestIdentityOutputStream ex
 
         byte[] input = transmitter.getData();
 
-        assertNotNull(input);
+        Assert.assertNotNull(input);
         byte[] expected = new byte[] {'a', 'b', 'c'};
-        assertEquals(expected.length, input.length);
+        Assert.assertEquals(expected.length, input.length);
         for (int i = 0; i < expected.length; i++) {
-            assertEquals(expected[i], input[i]);
+            Assert.assertEquals(expected[i], input[i]);
         }
     }
 
+    @Test
     public void testClosedCondition() throws Exception {
         SessionOutputBufferMockup transmitter = new SessionOutputBufferMockup();
         IdentityOutputStream outstream = new IdentityOutputStream(transmitter);
@@ -124,13 +126,13 @@ public class TestIdentityOutputStream ex
         try {
             byte[] tmp = new byte[2];
             outstream.write(tmp, 0, tmp.length);
-            fail("IOException should have been thrown");
+            Assert.fail("IOException should have been thrown");
         } catch (IOException e) {
             //expected
         }
         try {
             outstream.write('a');
-            fail("IOException should have been thrown");
+            Assert.fail("IOException should have been thrown");
         } catch (IOException e) {
             //expected
         }

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestMessageParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestMessageParser.java?rev=1100965&r1=1100964&r2=1100965&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestMessageParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestMessageParser.java Mon May  9 11:26:57 2011
@@ -29,8 +29,6 @@ package org.apache.http.impl.io;
 
 import java.io.IOException;
 
-import junit.framework.TestCase;
-
 import org.apache.http.Header;
 import org.apache.http.HeaderElement;
 import org.apache.http.NameValuePair;
@@ -38,32 +36,32 @@ import org.apache.http.ProtocolException
 import org.apache.http.io.SessionInputBuffer;
 import org.apache.http.message.BufferedHeader;
 import org.apache.http.mockup.SessionInputBufferMockup;
+import org.junit.Assert;
+import org.junit.Test;
 
 /**
  * Unit tests for {@link AbstractMessageParser}.
  */
-public class TestMessageParser extends TestCase {
-
-    public TestMessageParser(String testName) {
-        super(testName);
-    }
+public class TestMessageParser {
 
+    @Test
     public void testInvalidInput() throws Exception {
         try {
             // the first argument must not be null
             AbstractMessageParser.parseHeaders(null, -1, -1, null);
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
         try {
             new BufferedHeader(null);
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
     }
 
+    @Test
     public void testBasicHeaderParsing() throws Exception {
         String s =
             "header1: stuff\r\n" +
@@ -76,23 +74,24 @@ public class TestMessageParser extends T
         SessionInputBuffer receiver = new SessionInputBufferMockup(s, "US-ASCII");
         Header[] headers = AbstractMessageParser.parseHeaders
             (receiver, -1, -1, null);
-        assertNotNull(headers);
-        assertEquals(3, headers.length);
-        assertEquals("header1", headers[0].getName());
-        assertEquals("stuff", headers[0].getValue());
-        assertEquals("header2", headers[1].getName());
-        assertEquals("stuff", headers[1].getValue());
-        assertEquals("header3", headers[2].getName());
-        assertEquals("stuff and more stuff and even more stuff", headers[2].getValue());
+        Assert.assertNotNull(headers);
+        Assert.assertEquals(3, headers.length);
+        Assert.assertEquals("header1", headers[0].getName());
+        Assert.assertEquals("stuff", headers[0].getValue());
+        Assert.assertEquals("header2", headers[1].getName());
+        Assert.assertEquals("stuff", headers[1].getValue());
+        Assert.assertEquals("header3", headers[2].getName());
+        Assert.assertEquals("stuff and more stuff and even more stuff", headers[2].getValue());
 
         Header h = headers[0];
 
-        assertTrue(h instanceof BufferedHeader);
-        assertNotNull(((BufferedHeader)h).getBuffer());
-        assertEquals("header1: stuff", ((BufferedHeader)h).toString());
-        assertEquals(8, ((BufferedHeader)h).getValuePos());
+        Assert.assertTrue(h instanceof BufferedHeader);
+        Assert.assertNotNull(((BufferedHeader)h).getBuffer());
+        Assert.assertEquals("header1: stuff", ((BufferedHeader)h).toString());
+        Assert.assertEquals(8, ((BufferedHeader)h).getValuePos());
     }
 
+    @Test
     public void testBufferedHeader() throws Exception {
         String s =
             "header1  : stuff; param1 = value1; param2 = \"value 2\" \r\n" +
@@ -100,23 +99,24 @@ public class TestMessageParser extends T
         SessionInputBuffer receiver = new SessionInputBufferMockup(s, "US-ASCII");
         Header[] headers = AbstractMessageParser.parseHeaders
             (receiver, -1, -1, null);
-        assertNotNull(headers);
-        assertEquals(1, headers.length);
-        assertEquals("header1  : stuff; param1 = value1; param2 = \"value 2\" ", headers[0].toString());
+        Assert.assertNotNull(headers);
+        Assert.assertEquals(1, headers.length);
+        Assert.assertEquals("header1  : stuff; param1 = value1; param2 = \"value 2\" ", headers[0].toString());
         HeaderElement[] elements = headers[0].getElements();
-        assertNotNull(elements);
-        assertEquals(1, elements.length);
-        assertEquals("stuff", elements[0].getName());
-        assertEquals(null, elements[0].getValue());
+        Assert.assertNotNull(elements);
+        Assert.assertEquals(1, elements.length);
+        Assert.assertEquals("stuff", elements[0].getName());
+        Assert.assertEquals(null, elements[0].getValue());
         NameValuePair[] params = elements[0].getParameters();
-        assertNotNull(params);
-        assertEquals(2, params.length);
-        assertEquals("param1", params[0].getName());
-        assertEquals("value1", params[0].getValue());
-        assertEquals("param2", params[1].getName());
-        assertEquals("value 2", params[1].getValue());
+        Assert.assertNotNull(params);
+        Assert.assertEquals(2, params.length);
+        Assert.assertEquals("param1", params[0].getName());
+        Assert.assertEquals("value1", params[0].getValue());
+        Assert.assertEquals("param2", params[1].getName());
+        Assert.assertEquals("value 2", params[1].getValue());
     }
 
+    @Test
     public void testParsingInvalidHeaders() throws Exception {
         String s = "    stuff\r\n" +
             "header1: stuff\r\n" +
@@ -124,7 +124,7 @@ public class TestMessageParser extends T
         SessionInputBuffer receiver = new SessionInputBufferMockup(s, "US-ASCII");
         try {
             AbstractMessageParser.parseHeaders(receiver, -1, -1, null);
-            fail("ProtocolException should have been thrown");
+            Assert.fail("ProtocolException should have been thrown");
         } catch (ProtocolException ex) {
             // expected
         }
@@ -134,12 +134,13 @@ public class TestMessageParser extends T
         receiver = new SessionInputBufferMockup(s, "US-ASCII");
         try {
             AbstractMessageParser.parseHeaders(receiver, -1, -1, null);
-            fail("ProtocolException should have been thrown");
+            Assert.fail("ProtocolException should have been thrown");
         } catch (ProtocolException ex) {
             // expected
         }
     }
 
+    @Test
     public void testParsingMalformedFirstHeader() throws Exception {
         String s =
             "    header1: stuff\r\n" +
@@ -147,23 +148,25 @@ public class TestMessageParser extends T
         SessionInputBuffer receiver = new SessionInputBufferMockup(s, "US-ASCII");
         Header[] headers = AbstractMessageParser.parseHeaders
             (receiver, -1, -1, null);
-        assertNotNull(headers);
-        assertEquals(2, headers.length);
-        assertEquals("header1", headers[0].getName());
-        assertEquals("stuff", headers[0].getValue());
-        assertEquals("header2", headers[1].getName());
-        assertEquals("stuff", headers[1].getValue());
+        Assert.assertNotNull(headers);
+        Assert.assertEquals(2, headers.length);
+        Assert.assertEquals("header1", headers[0].getName());
+        Assert.assertEquals("stuff", headers[0].getValue());
+        Assert.assertEquals("header2", headers[1].getName());
+        Assert.assertEquals("stuff", headers[1].getValue());
     }
 
+    @Test
     public void testEmptyDataStream() throws Exception {
         String s = "";
         SessionInputBuffer receiver = new SessionInputBufferMockup(s, "US-ASCII");
         Header[] headers = AbstractMessageParser.parseHeaders
             (receiver, -1, -1, null);
-        assertNotNull(headers);
-        assertEquals(0, headers.length);
+        Assert.assertNotNull(headers);
+        Assert.assertEquals(0, headers.length);
     }
 
+    @Test
     public void testMaxHeaderCount() throws Exception {
         String s =
             "header1: stuff\r\n" +
@@ -173,12 +176,13 @@ public class TestMessageParser extends T
         SessionInputBuffer receiver = new SessionInputBufferMockup(s, "US-ASCII");
         try {
             AbstractMessageParser.parseHeaders(receiver, 2, -1, null);
-            fail("IOException should have been thrown");
+            Assert.fail("IOException should have been thrown");
         } catch (IOException ex) {
             // expected
         }
     }
 
+    @Test
     public void testMaxHeaderCountForFoldedHeader() throws Exception {
         String s =
             "header1: stuff\r\n" +
@@ -188,7 +192,7 @@ public class TestMessageParser extends T
         SessionInputBuffer receiver = new SessionInputBufferMockup(s, "US-ASCII");
         try {
             AbstractMessageParser.parseHeaders(receiver, 2, 15, null);
-            fail("IOException should have been thrown");
+            Assert.fail("IOException should have been thrown");
         } catch (IOException ex) {
             // expected
         }

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestRequestParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestRequestParser.java?rev=1100965&r1=1100964&r2=1100965&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestRequestParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestRequestParser.java Mon May  9 11:26:57 2011
@@ -33,8 +33,6 @@ package org.apache.http.impl.io;
 
 import java.io.InterruptedIOException;
 
-import junit.framework.TestCase;
-
 import org.apache.http.ConnectionClosedException;
 import org.apache.http.Header;
 import org.apache.http.HttpRequest;
@@ -46,16 +44,15 @@ import org.apache.http.message.BasicLine
 import org.apache.http.mockup.SessionInputBufferMockup;
 import org.apache.http.mockup.TimeoutByteArrayInputStream;
 import org.apache.http.params.BasicHttpParams;
+import org.junit.Assert;
+import org.junit.Test;
 
 /**
  * Unit tests for {@link HttpRequestParser}.
  */
-public class TestRequestParser extends TestCase {
-
-    public TestRequestParser(String testName) {
-        super(testName);
-    }
+public class TestRequestParser {
 
+    @Test
     public void testInvalidConstructorInput() throws Exception {
         try {
             new HttpRequestParser(
@@ -63,7 +60,7 @@ public class TestRequestParser extends T
                     BasicLineParser.DEFAULT,
                     new DefaultHttpRequestFactory(),
                     new BasicHttpParams());
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
@@ -74,7 +71,7 @@ public class TestRequestParser extends T
                     BasicLineParser.DEFAULT,
                     null,
                     new BasicHttpParams());
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
@@ -85,12 +82,13 @@ public class TestRequestParser extends T
                     BasicLineParser.DEFAULT,
                     new DefaultHttpRequestFactory(),
                     null);
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
     }
 
+    @Test
     public void testBasicMessageParsing() throws Exception {
         String s =
             "GET / HTTP/1.1\r\n" +
@@ -109,14 +107,15 @@ public class TestRequestParser extends T
         HttpRequest httprequest = (HttpRequest) parser.parse();
 
         RequestLine reqline = httprequest.getRequestLine();
-        assertNotNull(reqline);
-        assertEquals("GET", reqline.getMethod());
-        assertEquals("/", reqline.getUri());
-        assertEquals(HttpVersion.HTTP_1_1, reqline.getProtocolVersion());
+        Assert.assertNotNull(reqline);
+        Assert.assertEquals("GET", reqline.getMethod());
+        Assert.assertEquals("/", reqline.getUri());
+        Assert.assertEquals(HttpVersion.HTTP_1_1, reqline.getProtocolVersion());
         Header[] headers = httprequest.getAllHeaders();
-        assertEquals(3, headers.length);
+        Assert.assertEquals(3, headers.length);
     }
 
+    @Test
     public void testConnectionClosedException() throws Exception {
         SessionInputBuffer inbuffer = new SessionInputBufferMockup(new byte[] {});
 
@@ -128,11 +127,12 @@ public class TestRequestParser extends T
 
         try {
             parser.parse();
-            fail("ConnectionClosedException should have been thrown");
+            Assert.fail("ConnectionClosedException should have been thrown");
         } catch (ConnectionClosedException expected) {
         }
     }
 
+    @Test
     public void testMessageParsingTimeout() throws Exception {
         String s =
             "GET \000/ HTTP/1.1\r\000\n" +
@@ -161,17 +161,17 @@ public class TestRequestParser extends T
             }
 
         }
-        assertNotNull(httprequest);
-        assertEquals(5, timeoutCount);
+        Assert.assertNotNull(httprequest);
+        Assert.assertEquals(5, timeoutCount);
 
         @SuppressWarnings("null") // httprequest cannot be null here
         RequestLine reqline = httprequest.getRequestLine();
-        assertNotNull(reqline);
-        assertEquals("GET", reqline.getMethod());
-        assertEquals("/", reqline.getUri());
-        assertEquals(HttpVersion.HTTP_1_1, reqline.getProtocolVersion());
+        Assert.assertNotNull(reqline);
+        Assert.assertEquals("GET", reqline.getMethod());
+        Assert.assertEquals("/", reqline.getUri());
+        Assert.assertEquals(HttpVersion.HTTP_1_1, reqline.getProtocolVersion());
         Header[] headers = httprequest.getAllHeaders();
-        assertEquals(3, headers.length);
+        Assert.assertEquals(3, headers.length);
     }
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestResponseParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestResponseParser.java?rev=1100965&r1=1100964&r2=1100965&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestResponseParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestResponseParser.java Mon May  9 11:26:57 2011
@@ -29,8 +29,6 @@ package org.apache.http.impl.io;
 
 import java.io.InterruptedIOException;
 
-import junit.framework.TestCase;
-
 import org.apache.http.Header;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpVersion;
@@ -42,16 +40,15 @@ import org.apache.http.message.BasicLine
 import org.apache.http.mockup.SessionInputBufferMockup;
 import org.apache.http.mockup.TimeoutByteArrayInputStream;
 import org.apache.http.params.BasicHttpParams;
+import org.junit.Assert;
+import org.junit.Test;
 
 /**
  * Unit tests for {@link HttpResponseParser}.
  */
-public class TestResponseParser extends TestCase {
-
-    public TestResponseParser(String testName) {
-        super(testName);
-    }
+public class TestResponseParser {
 
+    @Test
     public void testInvalidConstructorInput() throws Exception {
         try {
             new HttpResponseParser(
@@ -59,7 +56,7 @@ public class TestResponseParser extends 
                     BasicLineParser.DEFAULT,
                     new DefaultHttpResponseFactory(),
                     new BasicHttpParams());
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
@@ -70,7 +67,7 @@ public class TestResponseParser extends 
                     BasicLineParser.DEFAULT,
                     null,
                     new BasicHttpParams());
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
@@ -81,12 +78,13 @@ public class TestResponseParser extends 
                     BasicLineParser.DEFAULT,
                     new DefaultHttpResponseFactory(),
                     null);
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
     }
 
+    @Test
     public void testBasicMessageParsing() throws Exception {
         String s =
             "HTTP/1.1 200 OK\r\n" +
@@ -105,14 +103,15 @@ public class TestResponseParser extends 
         HttpResponse httpresponse = (HttpResponse) parser.parse();
 
         StatusLine statusline = httpresponse.getStatusLine();
-        assertNotNull(statusline);
-        assertEquals(200, statusline.getStatusCode());
-        assertEquals("OK", statusline.getReasonPhrase());
-        assertEquals(HttpVersion.HTTP_1_1, statusline.getProtocolVersion());
+        Assert.assertNotNull(statusline);
+        Assert.assertEquals(200, statusline.getStatusCode());
+        Assert.assertEquals("OK", statusline.getReasonPhrase());
+        Assert.assertEquals(HttpVersion.HTTP_1_1, statusline.getProtocolVersion());
         Header[] headers = httpresponse.getAllHeaders();
-        assertEquals(3, headers.length);
+        Assert.assertEquals(3, headers.length);
     }
 
+    @Test
     public void testConnectionClosedException() throws Exception {
         SessionInputBuffer inbuffer = new SessionInputBufferMockup(new byte[] {});
 
@@ -124,11 +123,12 @@ public class TestResponseParser extends 
 
         try {
             parser.parse();
-            fail("NoHttpResponseException should have been thrown");
+            Assert.fail("NoHttpResponseException should have been thrown");
         } catch (NoHttpResponseException expected) {
         }
     }
 
+    @Test
     public void testMessageParsingTimeout() throws Exception {
         String s =
             "HTTP\000/1.1 200\000 OK\r\n" +
@@ -157,17 +157,17 @@ public class TestResponseParser extends 
             }
 
         }
-        assertNotNull(httpresponse);
-        assertEquals(5, timeoutCount);
+        Assert.assertNotNull(httpresponse);
+        Assert.assertEquals(5, timeoutCount);
 
         @SuppressWarnings("null") // httpresponse cannot be null here
         StatusLine statusline = httpresponse.getStatusLine();
-        assertNotNull(statusline);
-        assertEquals(200, statusline.getStatusCode());
-        assertEquals("OK", statusline.getReasonPhrase());
-        assertEquals(HttpVersion.HTTP_1_1, statusline.getProtocolVersion());
+        Assert.assertNotNull(statusline);
+        Assert.assertEquals(200, statusline.getStatusCode());
+        Assert.assertEquals("OK", statusline.getReasonPhrase());
+        Assert.assertEquals(HttpVersion.HTTP_1_1, statusline.getProtocolVersion());
         Header[] headers = httpresponse.getAllHeaders();
-        assertEquals(3, headers.length);
+        Assert.assertEquals(3, headers.length);
     }
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/message/TestAbstractMessage.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/message/TestAbstractMessage.java?rev=1100965&r1=1100964&r2=1100965&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/message/TestAbstractMessage.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/message/TestAbstractMessage.java Mon May  9 11:26:57 2011
@@ -27,65 +27,63 @@
 
 package org.apache.http.message;
 
-import junit.framework.TestCase;
-
 import org.apache.http.Header;
 import org.apache.http.HttpMessage;
 import org.apache.http.mockup.HttpMessageMockup;
 import org.apache.http.params.BasicHttpParams;
 import org.apache.http.params.HttpParams;
+import org.junit.Assert;
+import org.junit.Test;
 
 /**
  * Unit tests for {@link Header}.
  *
  */
-public class TestAbstractMessage extends TestCase {
-
-    public TestAbstractMessage(String testName) {
-        super(testName);
-    }
+public class TestAbstractMessage {
 
+    @Test
     public void testBasicProperties() {
         HttpMessage message = new HttpMessageMockup();
-        assertNotNull(message.getParams());
-        assertNotNull(message.headerIterator());
+        Assert.assertNotNull(message.getParams());
+        Assert.assertNotNull(message.headerIterator());
         Header[] headers = message.getAllHeaders();
-        assertNotNull(headers);
-        assertEquals(0, headers.length);
+        Assert.assertNotNull(headers);
+        Assert.assertEquals(0, headers.length);
     }
 
+    @Test
     public void testBasicHeaderOps() {
         HttpMessage message = new HttpMessageMockup();
-        assertFalse(message.containsHeader("whatever"));
+        Assert.assertFalse(message.containsHeader("whatever"));
 
         message.addHeader("name", "1");
         message.addHeader("name", "2");
 
         Header[] headers = message.getAllHeaders();
-        assertNotNull(headers);
-        assertEquals(2, headers.length);
+        Assert.assertNotNull(headers);
+        Assert.assertEquals(2, headers.length);
 
         Header h = message.getFirstHeader("name");
-        assertNotNull(h);
-        assertEquals("1", h.getValue());
+        Assert.assertNotNull(h);
+        Assert.assertEquals("1", h.getValue());
 
         message.setHeader("name", "3");
         h = message.getFirstHeader("name");
-        assertNotNull(h);
-        assertEquals("3", h.getValue());
+        Assert.assertNotNull(h);
+        Assert.assertEquals("3", h.getValue());
         h = message.getLastHeader("name");
-        assertNotNull(h);
-        assertEquals("2", h.getValue());
+        Assert.assertNotNull(h);
+        Assert.assertEquals("2", h.getValue());
 
         // Should have no effect
         message.addHeader(null);
         message.setHeader(null);
 
         headers = message.getHeaders("name");
-        assertNotNull(headers);
-        assertEquals(2, headers.length);
-        assertEquals("3", headers[0].getValue());
-        assertEquals("2", headers[1].getValue());
+        Assert.assertNotNull(headers);
+        Assert.assertEquals(2, headers.length);
+        Assert.assertEquals("3", headers[0].getValue());
+        Assert.assertEquals("2", headers[1].getValue());
 
         message.addHeader("name", "4");
 
@@ -93,50 +91,52 @@ public class TestAbstractMessage extends
         message.setHeaders(headers);
 
         headers = message.getHeaders("name");
-        assertNotNull(headers);
-        assertEquals(2, headers.length);
-        assertEquals("3", headers[0].getValue());
-        assertEquals("5", headers[1].getValue());
+        Assert.assertNotNull(headers);
+        Assert.assertEquals(2, headers.length);
+        Assert.assertEquals("3", headers[0].getValue());
+        Assert.assertEquals("5", headers[1].getValue());
 
         message.setHeader("whatever", null);
         message.removeHeaders("name");
         message.removeHeaders(null);
         headers = message.getAllHeaders();
-        assertNotNull(headers);
-        assertEquals(1, headers.length);
-        assertEquals(null, headers[0].getValue());
+        Assert.assertNotNull(headers);
+        Assert.assertEquals(1, headers.length);
+        Assert.assertEquals(null, headers[0].getValue());
 
         message.removeHeader(message.getFirstHeader("whatever"));
         headers = message.getAllHeaders();
-        assertNotNull(headers);
-        assertEquals(0, headers.length);
+        Assert.assertNotNull(headers);
+        Assert.assertEquals(0, headers.length);
     }
 
+    @Test
     public void testParameters() {
         HttpMessage message = new HttpMessageMockup();
-        assertNotNull(message.getParams());
+        Assert.assertNotNull(message.getParams());
         HttpParams params = new BasicHttpParams();
         message.setParams(params);
-        assertTrue(params == message.getParams());
+        Assert.assertTrue(params == message.getParams());
     }
 
+    @Test
     public void testInvalidInput() {
         HttpMessage message = new HttpMessageMockup();
         try {
             message.setParams(null);
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
         try {
             message.addHeader(null, null);
-            fail("IllegalArgumentException should have been thrown");
+            Assert.fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
         try {
             message.setHeader(null, 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/message/TestBasicHeaderElementIterator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/message/TestBasicHeaderElementIterator.java?rev=1100965&r1=1100964&r2=1100965&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/message/TestBasicHeaderElementIterator.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/message/TestBasicHeaderElementIterator.java Mon May  9 11:26:57 2011
@@ -29,23 +29,19 @@ package org.apache.http.message;
 
 import java.util.NoSuchElementException;
 
-import junit.framework.TestCase;
-
 import org.apache.http.Header;
 import org.apache.http.HeaderElement;
 import org.apache.http.HeaderElementIterator;
+import org.junit.Assert;
+import org.junit.Test;
 
 /**
  * Tests for {@link BasicHeaderElementIterator}.
  *
  */
-public class TestBasicHeaderElementIterator extends TestCase {
-
-    // ------------------------------------------------------------ Constructor
-    public TestBasicHeaderElementIterator(String testName) {
-        super(testName);
-    }
+public class TestBasicHeaderElementIterator {
 
+    @Test
     public void testMultiHeader() {
         Header[] headers = new Header[]{
                 new BasicHeader("Name", "value0"),
@@ -56,33 +52,34 @@ public class TestBasicHeaderElementItera
                 new BasicHeaderElementIterator(
                         new BasicHeaderIterator(headers, "Name"));
 
-        assertTrue(hei.hasNext());
+        Assert.assertTrue(hei.hasNext());
         HeaderElement elem = hei.next();
-        assertEquals("The two header values must be equal",
+        Assert.assertEquals("The two header values must be equal",
                 "value0", elem.getName());
 
-        assertTrue(hei.hasNext());
+        Assert.assertTrue(hei.hasNext());
         elem = hei.next();
-        assertEquals("The two header values must be equal",
+        Assert.assertEquals("The two header values must be equal",
                 "value1", elem.getName());
 
-        assertFalse(hei.hasNext());
+        Assert.assertFalse(hei.hasNext());
         try {
             hei.next();
-            fail("NoSuchElementException should have been thrown");
+            Assert.fail("NoSuchElementException should have been thrown");
         } catch (NoSuchElementException ex) {
             // expected
         }
 
-        assertFalse(hei.hasNext());
+        Assert.assertFalse(hei.hasNext());
         try {
             hei.next();
-            fail("NoSuchElementException should have been thrown");
+            Assert.fail("NoSuchElementException should have been thrown");
         } catch (NoSuchElementException ex) {
             // expected
         }
     }
 
+    @Test
     public void testMultiHeaderSameLine() {
         Header[] headers = new Header[]{
                 new BasicHeader("name", "value0,value1"),
@@ -93,24 +90,25 @@ public class TestBasicHeaderElementItera
                 new BasicHeaderElementIterator(new BasicHeaderIterator(headers, "Name"));
 
         HeaderElement elem = hei.next();
-        assertEquals("The two header values must be equal",
+        Assert.assertEquals("The two header values must be equal",
                 "value0", elem.getName());
         elem = hei.next();
-        assertEquals("The two header values must be equal",
+        Assert.assertEquals("The two header values must be equal",
                 "value1", elem.getName());
         elem = hei.next();
-        assertEquals("The two header values must be equal",
+        Assert.assertEquals("The two header values must be equal",
                 "cookie1", elem.getName());
-        assertEquals("The two header values must be equal",
+        Assert.assertEquals("The two header values must be equal",
                 "1", elem.getValue());
 
         elem = hei.next();
-        assertEquals("The two header values must be equal",
+        Assert.assertEquals("The two header values must be equal",
                 "cookie2", elem.getName());
-        assertEquals("The two header values must be equal",
+        Assert.assertEquals("The two header values must be equal",
                 "2", elem.getValue());
     }
 
+    @Test
     public void testFringeCases() {
         Header[] headers = new Header[]{
                 new BasicHeader("Name", null),
@@ -122,18 +120,18 @@ public class TestBasicHeaderElementItera
                 new BasicHeaderElementIterator(
                         new BasicHeaderIterator(headers, "Name"));
 
-        assertFalse(hei.hasNext());
+        Assert.assertFalse(hei.hasNext());
         try {
             hei.next();
-            fail("NoSuchElementException should have been thrown");
+            Assert.fail("NoSuchElementException should have been thrown");
         } catch (NoSuchElementException ex) {
             // expected
         }
 
-        assertFalse(hei.hasNext());
+        Assert.assertFalse(hei.hasNext());
         try {
             hei.next();
-            fail("NoSuchElementException should have been thrown");
+            Assert.fail("NoSuchElementException should have been thrown");
         } catch (NoSuchElementException ex) {
             // expected
         }

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/message/TestBasicHeaderIterator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/message/TestBasicHeaderIterator.java?rev=1100965&r1=1100964&r2=1100965&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/message/TestBasicHeaderIterator.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/message/TestBasicHeaderIterator.java Mon May  9 11:26:57 2011
@@ -29,25 +29,19 @@ package org.apache.http.message;
 
 import java.util.NoSuchElementException;
 
-import junit.framework.TestCase;
-
 import org.apache.http.Header;
 import org.apache.http.HeaderIterator;
+import org.junit.Assert;
+import org.junit.Test;
 
 
 /**
  * Tests for {@link BasicHeaderIterator}.
  *
  */
-public class TestBasicHeaderIterator extends TestCase {
-
-    // ------------------------------------------------------------ Constructor
-    public TestBasicHeaderIterator(String testName) {
-        super(testName);
-    }
-
-    // ------------------------------------------------------- TestCase Methods
+public class TestBasicHeaderIterator {
 
+    @Test
     public void testAllSame() {
         Header[] headers = new Header[]{
             new BasicHeader("Name", "value0"),
@@ -58,30 +52,31 @@ public class TestBasicHeaderIterator ext
 
         // without filter
         HeaderIterator hit = new BasicHeaderIterator(headers, null);
-        assertTrue(hit.hasNext());
-        assertEquals("0", headers[0], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("1", headers[1], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("2", headers[2], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("3", headers[3], hit.nextHeader());
-        assertFalse(hit.hasNext());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("0", headers[0], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("1", headers[1], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("2", headers[2], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("3", headers[3], hit.nextHeader());
+        Assert.assertFalse(hit.hasNext());
 
         // with filter
         hit = new BasicHeaderIterator(headers, "name");
-        assertTrue(hit.hasNext());
-        assertEquals("0", headers[0], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("1", headers[1], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("2", headers[2], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("3", headers[3], hit.nextHeader());
-        assertFalse(hit.hasNext());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("0", headers[0], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("1", headers[1], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("2", headers[2], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("3", headers[3], hit.nextHeader());
+        Assert.assertFalse(hit.hasNext());
     }
 
 
+    @Test
     public void testFirstLastOneNone() {
         Header[] headers = new Header[]{
             new BasicHeader("match"   , "value0"),
@@ -92,36 +87,37 @@ public class TestBasicHeaderIterator ext
 
         // without filter
         HeaderIterator hit = new BasicHeaderIterator(headers, null);
-        assertTrue(hit.hasNext());
-        assertEquals("0", headers[0], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("1", headers[1], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("2", headers[2], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("3", headers[3], hit.nextHeader());
-        assertFalse(hit.hasNext());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("0", headers[0], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("1", headers[1], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("2", headers[2], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("3", headers[3], hit.nextHeader());
+        Assert.assertFalse(hit.hasNext());
 
         // with filter, first & last
         hit = new BasicHeaderIterator(headers, "match");
-        assertTrue(hit.hasNext());
-        assertEquals("0", headers[0], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("3", headers[3], hit.nextHeader());
-        assertFalse(hit.hasNext());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("0", headers[0], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("3", headers[3], hit.nextHeader());
+        Assert.assertFalse(hit.hasNext());
 
         // with filter, one match
         hit = new BasicHeaderIterator(headers, "single");
-        assertTrue(hit.hasNext());
-        assertEquals("2", headers[2], hit.nextHeader());
-        assertFalse(hit.hasNext());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("2", headers[2], hit.nextHeader());
+        Assert.assertFalse(hit.hasNext());
 
         // with filter, no match
         hit = new BasicHeaderIterator(headers, "way-off");
-        assertFalse(hit.hasNext());
+        Assert.assertFalse(hit.hasNext());
     }
 
 
+    @Test
     public void testInterspersed() {
         Header[] headers = new Header[]{
             new BasicHeader("yellow", "00"),
@@ -143,106 +139,108 @@ public class TestBasicHeaderIterator ext
 
         // without filter
         HeaderIterator hit = new BasicHeaderIterator(headers, null);
-        assertTrue(hit.hasNext());
-        assertEquals("0", headers[0], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("1", headers[1], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("2", headers[2], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("3", headers[3], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("4", headers[4], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("5", headers[5], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("6", headers[6], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("7", headers[7], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("8", headers[8], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("9", headers[9], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("a", headers[10], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("b", headers[11], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("c", headers[12], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("d", headers[13], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("e", headers[14], hit.nextHeader());
-        assertFalse(hit.hasNext());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("0", headers[0], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("1", headers[1], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("2", headers[2], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("3", headers[3], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("4", headers[4], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("5", headers[5], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("6", headers[6], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("7", headers[7], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("8", headers[8], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("9", headers[9], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("a", headers[10], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("b", headers[11], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("c", headers[12], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("d", headers[13], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("e", headers[14], hit.nextHeader());
+        Assert.assertFalse(hit.hasNext());
 
         // yellow 0, 5, 9, 11, 13
         hit = new BasicHeaderIterator(headers, "Yellow");
-        assertTrue(hit.hasNext());
-        assertEquals("0", headers[0], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("5", headers[5], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("9", headers[9], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("b", headers[11], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("d", headers[13], hit.nextHeader());
-        assertFalse(hit.hasNext());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("0", headers[0], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("5", headers[5], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("9", headers[9], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("b", headers[11], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("d", headers[13], hit.nextHeader());
+        Assert.assertFalse(hit.hasNext());
 
         // maroon 1, 6, 7, 8, 10
         hit = new BasicHeaderIterator(headers, "marOOn");
-        assertTrue(hit.hasNext());
-        assertEquals("1", headers[1], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("6", headers[6], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("7", headers[7], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("8", headers[8], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("a", headers[10], hit.nextHeader());
-        assertFalse(hit.hasNext());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("1", headers[1], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("6", headers[6], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("7", headers[7], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("8", headers[8], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("a", headers[10], hit.nextHeader());
+        Assert.assertFalse(hit.hasNext());
 
         // orange 2, 3, 4, 12, 14
         hit = new BasicHeaderIterator(headers, "OranGe");
-        assertTrue(hit.hasNext());
-        assertEquals("2", headers[2], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("3", headers[3], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("4", headers[4], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("b", headers[12], hit.nextHeader());
-        assertTrue(hit.hasNext());
-        assertEquals("e", headers[14], hit.nextHeader());
-        assertFalse(hit.hasNext());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("2", headers[2], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("3", headers[3], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("4", headers[4], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("b", headers[12], hit.nextHeader());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("e", headers[14], hit.nextHeader());
+        Assert.assertFalse(hit.hasNext());
     }
 
 
+    @Test
     public void testInvalid() {
 
         HeaderIterator hit = null;
         try {
             hit = new BasicHeaderIterator(null, "whatever");
-            fail("null headers not detected");
+            Assert.fail("null headers not detected");
         } catch (IllegalArgumentException iax) {
             // expected
         }
 
         // this is not invalid
         hit = new BasicHeaderIterator(new Header[0], "whatever");
-        assertFalse(hit.hasNext());
+        Assert.assertFalse(hit.hasNext());
 
         // but this is
         try {
             hit.nextHeader();
-            fail("next beyond end not detected");
+            Assert.fail("next beyond end not detected");
         } catch (NoSuchElementException nsx) {
             // expected
         }
     }
 
 
+    @Test
     public void testRemaining() {
         // to satisfy Clover and take coverage to 100%
 
@@ -255,25 +253,25 @@ public class TestBasicHeaderIterator ext
 
         // without filter, using plain next()
         HeaderIterator hit = new BasicHeaderIterator(headers, null);
-        assertTrue(hit.hasNext());
-        assertEquals("0", headers[0], hit.next());
-        assertTrue(hit.hasNext());
-        assertEquals("1", headers[1], hit.next());
-        assertTrue(hit.hasNext());
-        assertEquals("2", headers[2], hit.next());
-        assertTrue(hit.hasNext());
-        assertEquals("3", headers[3], hit.next());
-        assertFalse(hit.hasNext());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("0", headers[0], hit.next());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("1", headers[1], hit.next());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("2", headers[2], hit.next());
+        Assert.assertTrue(hit.hasNext());
+        Assert.assertEquals("3", headers[3], hit.next());
+        Assert.assertFalse(hit.hasNext());
 
         hit = new BasicHeaderIterator(headers, null);
-        assertTrue(hit.hasNext());
+        Assert.assertTrue(hit.hasNext());
         try {
             hit.remove();
-            fail("remove not detected");
+            Assert.fail("remove not detected");
         } catch (UnsupportedOperationException uox) {
             // expected
         }
 
-        assertTrue("no next", ((BasicHeaderIterator)hit).findNext(-3) < 0);
+        Assert.assertTrue("no next", ((BasicHeaderIterator)hit).findNext(-3) < 0);
     }
 }



Mime
View raw message