commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1087894 [1/2] - in /commons/proper/codec/trunk/src: changes/ test/org/apache/commons/codec/ test/org/apache/commons/codec/binary/ test/org/apache/commons/codec/digest/ test/org/apache/commons/codec/language/ test/org/apache/commons/codec/net/
Date Fri, 01 Apr 2011 20:59:04 GMT
Author: ggregory
Date: Fri Apr  1 20:59:03 2011
New Revision: 1087894

URL: http://svn.apache.org/viewvc?rev=1087894&view=rev
Log:
Migrate to JUnit 4 https://issues.apache.org/jira/browse/CODEC-120

Modified:
    commons/proper/codec/trunk/src/changes/changes.xml
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/BinaryEncoderAbstractTest.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/CharEncodingTest.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/DecoderExceptionTest.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/EncoderExceptionTest.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/StringEncoderAbstractTest.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/StringEncoderComparatorTest.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32InputStreamTest.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32OutputStreamTest.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32Test.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64Codec13Test.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64InputStreamTest.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64OutputStreamTest.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64Test.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/BaseNCodecTest.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/BinaryCodecTest.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/HexTest.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/StringUtilsTest.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/digest/DigestUtilsTest.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/Caverphone1Test.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/Caverphone2Test.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/CaverphoneTest.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/ColognePhoneticTest.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/DoubleMetaphone2Test.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/DoubleMetaphoneTest.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/MetaphoneTest.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/RefinedSoundexTest.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/SoundexTest.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/net/BCodecTest.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/net/QCodecTest.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/net/QuotedPrintableCodecTest.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/net/RFC1522CodecTest.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/net/URLCodecTest.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/net/UtilsTest.java

Modified: commons/proper/codec/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/changes/changes.xml?rev=1087894&r1=1087893&r2=1087894&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/changes/changes.xml (original)
+++ commons/proper/codec/trunk/src/changes/changes.xml Fri Apr  1 20:59:03 2011
@@ -23,6 +23,12 @@
     </properties>
     <body>
         <release version="2.0" date="TBA" description="Feature and fix release.">
+            <action dev="ggregory" type="update" issue="CODEC-119">
+             Migrate to Java 5.
+            </action>
+            <action dev="ggregory" type="update" issue="CODEC-120">
+             Migrate to JUnit 4.
+            </action>
 		</release>
         <release version="1.5" date="29 March 2011" description="Feature and fix release.">
             <action dev="sebb" type="fix" issue="CODEC-89">

Modified: commons/proper/codec/trunk/src/test/org/apache/commons/codec/BinaryEncoderAbstractTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/BinaryEncoderAbstractTest.java?rev=1087894&r1=1087893&r2=1087894&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/org/apache/commons/codec/BinaryEncoderAbstractTest.java (original)
+++ commons/proper/codec/trunk/src/test/org/apache/commons/codec/BinaryEncoderAbstractTest.java Fri Apr  1 20:59:03 2011
@@ -17,27 +17,23 @@
 
 package org.apache.commons.codec;
 
-import junit.framework.TestCase;
+import org.junit.Test;
 
 /**
  * @author Apache Software Foundation
  * @version $Id$
  */
-public abstract class BinaryEncoderAbstractTest extends TestCase {
-
-    public BinaryEncoderAbstractTest(String name) {
-        super(name);
-    }
+public abstract class BinaryEncoderAbstractTest {
 
     protected abstract BinaryEncoder makeEncoder();
 
-    // ------------------------------------------------------------------------
-
+    @Test
     public void testEncodeEmpty() throws Exception {
         BinaryEncoder encoder = makeEncoder();
         encoder.encode(new byte[0]);
-    }        
+    }
 
+    @Test
     public void testEncodeNull() throws Exception {
         BinaryEncoder encoder = makeEncoder();
         try {
@@ -45,5 +41,5 @@ public abstract class BinaryEncoderAbstr
         } catch (EncoderException ee) {
             // An exception should be thrown
         }
-    }        
+    }
 }

Modified: commons/proper/codec/trunk/src/test/org/apache/commons/codec/CharEncodingTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/CharEncodingTest.java?rev=1087894&r1=1087893&r2=1087894&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/org/apache/commons/codec/CharEncodingTest.java (original)
+++ commons/proper/codec/trunk/src/test/org/apache/commons/codec/CharEncodingTest.java Fri Apr  1 20:59:03 2011
@@ -18,7 +18,8 @@
 package org.apache.commons.codec;
 
 import junit.framework.Assert;
-import junit.framework.TestCase;
+
+import org.junit.Test;
 
 /**
  * Sanity checks for {@link CharEncoding}.
@@ -26,35 +27,42 @@ import junit.framework.TestCase;
  * @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
  * @version $Id$
  */
-public class CharEncodingTest extends TestCase {
+public class CharEncodingTest {
 
     /**
      * We could make the constructor private in the future, it's a matter a style.
      */
+    @Test
     public void testConstructor() {
         new CharEncoding();
     }
 
+    @Test
     public void testIso8859_1() {
         Assert.assertEquals("ISO-8859-1", CharEncoding.ISO_8859_1);
     }
 
+    @Test
     public void testUsAscii() {
         Assert.assertEquals("US-ASCII", CharEncoding.US_ASCII);
     }
 
+    @Test
     public void testUtf16() {
         Assert.assertEquals("UTF-16", CharEncoding.UTF_16);
     }
 
+    @Test
     public void testUtf16Be() {
         Assert.assertEquals("UTF-16BE", CharEncoding.UTF_16BE);
     }
 
+    @Test
     public void testUtf16Le() {
         Assert.assertEquals("UTF-16LE", CharEncoding.UTF_16LE);
     }
 
+    @Test
     public void testUtf8() {
         Assert.assertEquals("UTF-8", CharEncoding.UTF_8);
     }

Modified: commons/proper/codec/trunk/src/test/org/apache/commons/codec/DecoderExceptionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/DecoderExceptionTest.java?rev=1087894&r1=1087893&r2=1087894&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/org/apache/commons/codec/DecoderExceptionTest.java (original)
+++ commons/proper/codec/trunk/src/test/org/apache/commons/codec/DecoderExceptionTest.java Fri Apr  1 20:59:03 2011
@@ -17,7 +17,10 @@
 
 package org.apache.commons.codec;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import org.junit.Test;
 
 /**
  * Tests {@link DecoderException}.
@@ -25,30 +28,34 @@ import junit.framework.TestCase;
  * @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
  * @version $Id$
  */
-public class DecoderExceptionTest extends TestCase {
+public class DecoderExceptionTest {
 
     private static final String MSG = "TEST";
 
     private static final Throwable t = new Exception();
 
+    @Test
     public void testConstructor0() {
         DecoderException e = new DecoderException();
         assertNull(e.getMessage());
         assertNull(e.getCause());
     }
 
+    @Test
     public void testConstructorString() {
         DecoderException e = new DecoderException(MSG);
         assertEquals(MSG, e.getMessage());
         assertNull(e.getCause());
     }
 
+    @Test
     public void testConstructorStringThrowable() {
         DecoderException e = new DecoderException(MSG, t);
         assertEquals(MSG, e.getMessage());
         assertEquals(t, e.getCause());
     }
 
+    @Test
     public void testConstructorThrowable() {
         DecoderException e = new DecoderException(t);
         assertEquals(t.getClass().getName(), e.getMessage());

Modified: commons/proper/codec/trunk/src/test/org/apache/commons/codec/EncoderExceptionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/EncoderExceptionTest.java?rev=1087894&r1=1087893&r2=1087894&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/org/apache/commons/codec/EncoderExceptionTest.java (original)
+++ commons/proper/codec/trunk/src/test/org/apache/commons/codec/EncoderExceptionTest.java Fri Apr  1 20:59:03 2011
@@ -17,7 +17,10 @@
 
 package org.apache.commons.codec;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import org.junit.Test;
 
 /**
  * Tests {@link EncoderException}.
@@ -25,30 +28,34 @@ import junit.framework.TestCase;
  * @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
  * @version $Id$
  */
-public class EncoderExceptionTest extends TestCase {
+public class EncoderExceptionTest {
 
     private static final String MSG = "TEST";
 
     private static final Throwable t = new Exception();
 
+    @Test
     public void testConstructor0() {
         EncoderException e = new EncoderException();
         assertNull(e.getMessage());
         assertNull(e.getCause());
     }
 
+    @Test
     public void testConstructorString() {
         EncoderException e = new EncoderException(MSG);
         assertEquals(MSG, e.getMessage());
         assertNull(e.getCause());
     }
 
+    @Test
     public void testConstructorStringThrowable() {
         EncoderException e = new EncoderException(MSG, t);
         assertEquals(MSG, e.getMessage());
         assertEquals(t, e.getCause());
     }
 
+    @Test
     public void testConstructorThrowable() {
         EncoderException e = new EncoderException(t);
         assertEquals(t.getClass().getName(), e.getMessage());

Modified: commons/proper/codec/trunk/src/test/org/apache/commons/codec/StringEncoderAbstractTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/StringEncoderAbstractTest.java?rev=1087894&r1=1087893&r2=1087894&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/org/apache/commons/codec/StringEncoderAbstractTest.java (original)
+++ commons/proper/codec/trunk/src/test/org/apache/commons/codec/StringEncoderAbstractTest.java Fri Apr  1 20:59:03 2011
@@ -20,20 +20,17 @@ package org.apache.commons.codec;
 import java.util.Locale;
 
 import junit.framework.Assert;
-import junit.framework.TestCase;
+
+import org.junit.Test;
 
 /**
  * @author Apache Software Foundation
  * @version $Id$
  */
-public abstract class StringEncoderAbstractTest extends TestCase {
+public abstract class StringEncoderAbstractTest {
 
     protected StringEncoder stringEncoder = this.createStringEncoder();
 
-    public StringEncoderAbstractTest(String name) {
-        super(name);
-    }
-
     public void checkEncoding(String expected, String source) throws EncoderException {
         Assert.assertEquals("Source: " + source, expected, this.getStringEncoder().encode(source));
     }
@@ -56,6 +53,7 @@ public abstract class StringEncoderAbstr
         return this.stringEncoder;
     }
 
+    @Test
     public void testEncodeEmpty() throws Exception {
         Encoder encoder = this.getStringEncoder();
         encoder.encode("");
@@ -63,6 +61,7 @@ public abstract class StringEncoderAbstr
         encoder.encode("\t");
     }
 
+    @Test
     public void testEncodeNull() throws Exception {
         StringEncoder encoder = this.getStringEncoder();
         try {
@@ -72,8 +71,8 @@ public abstract class StringEncoderAbstr
         }
     }
 
+    @Test
     public void testEncodeWithInvalidObject() throws Exception {
-
         boolean exceptionThrown = false;
         try {
             StringEncoder encoder = this.getStringEncoder();
@@ -81,10 +80,10 @@ public abstract class StringEncoderAbstr
         } catch (Exception e) {
             exceptionThrown = true;
         }
-
         Assert.assertTrue("An exception was not thrown when we tried to encode " + "a Float object", exceptionThrown);
     }
 
+    @Test
     public void testLocaleIndependence() throws Exception {
         StringEncoder encoder = this.getStringEncoder();
 

Modified: commons/proper/codec/trunk/src/test/org/apache/commons/codec/StringEncoderComparatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/StringEncoderComparatorTest.java?rev=1087894&r1=1087893&r2=1087894&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/org/apache/commons/codec/StringEncoderComparatorTest.java (original)
+++ commons/proper/codec/trunk/src/test/org/apache/commons/codec/StringEncoderComparatorTest.java Fri Apr  1 20:59:03 2011
@@ -17,14 +17,16 @@
 
 package org.apache.commons.codec;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
-import junit.framework.TestCase;
-
 import org.apache.commons.codec.language.DoubleMetaphone;
 import org.apache.commons.codec.language.Soundex;
+import org.junit.Test;
 
 /**
  * Test cases for the StingEncoderComparator.
@@ -32,16 +34,14 @@ import org.apache.commons.codec.language
  * @author Apache Software Foundation
  * @version $Id$
  */
-public class StringEncoderComparatorTest extends TestCase {
-
-    public StringEncoderComparatorTest(String name) {
-        super(name);
-    }
+public class StringEncoderComparatorTest {
 
+    @Test
     public void testComparatorNoArgCon() throws Exception {
         new StringEncoderComparator();
     }        
 
+    @Test
     public void testComparatorWithSoundex() throws Exception {
         StringEncoderComparator sCompare = 
             new StringEncoderComparator( new Soundex() );
@@ -51,6 +51,7 @@ public class StringEncoderComparatorTest
                     0 == sCompare.compare( "O'Brien", "O'Brian" ) );
     }
     
+    @Test
     public void testComparatorWithDoubleMetaphone() throws Exception {
         StringEncoderComparator sCompare =
             new StringEncoderComparator( new DoubleMetaphone() );
@@ -69,6 +70,7 @@ public class StringEncoderComparatorTest
         }
     }
 
+    @Test
     public void testComparatorWithDoubleMetaphoneAndInvalidInput() throws Exception {
         StringEncoderComparator sCompare =
             new StringEncoderComparator( new DoubleMetaphone() );
@@ -76,6 +78,5 @@ public class StringEncoderComparatorTest
         int compare = sCompare.compare(new Double(3.0), new Long(3));
         assertEquals( "Trying to compare objects that make no sense to the underlying encoder should return a zero compare code",
                                 0, compare);        
-        
     }
 }

Modified: commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32InputStreamTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32InputStreamTest.java?rev=1087894&r1=1087893&r2=1087894&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32InputStreamTest.java (original)
+++ commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32InputStreamTest.java Fri Apr  1 20:59:03 2011
@@ -17,32 +17,28 @@
 
 package org.apache.commons.codec.binary;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Arrays;
 
-import junit.framework.TestCase;
+import org.junit.Test;
 
-public class Base32InputStreamTest extends TestCase {
+public class Base32InputStreamTest {
 
     private final static byte[] CRLF = {(byte) '\r', (byte) '\n'};
 
     private final static byte[] LF = {(byte) '\n'};
 
     /**
-     * Construct a new instance of this test case.
-     * 
-     * @param name
-     *            Name of the test case
-     */
-    public Base32InputStreamTest(String name) {
-        super(name);
-    }
-
-    /**
      * Tests the bug reported in CODEC-105. Bad interactions with InputStream when reading one byte at a time.
      */
+    @Test
     public void testCodec105() throws IOException {
         Base32InputStream in = new Base32InputStream(new Codec105ErrorInputStream(), true, 0, null);
         for (int i = 0; i < 5; i++) {
@@ -56,6 +52,7 @@ public class Base32InputStreamTest exten
 //     *
 //     * @throws Exception for some failure scenarios.
 //     */
+//    @Test
 //    public void testCodec101() throws Exception {
 //        byte[] codec101 = StringUtils.getBytesUtf8(Base32TestData.CODEC_101_MULTIPLE_OF_3);
 //        ByteArrayInputStream bais = new ByteArrayInputStream(codec101);
@@ -87,6 +84,7 @@ public class Base32InputStreamTest exten
      *
      * @throws Exception for some failure scenarios.
      */
+//    @Test
 //    public void testInputStreamReader() throws Exception {
 //        byte[] codec101 = StringUtils.getBytesUtf8(Base32TestData.CODEC_101_MULTIPLE_OF_3);
 //        ByteArrayInputStream bais = new ByteArrayInputStream(codec101);
@@ -103,6 +101,7 @@ public class Base32InputStreamTest exten
      *
      * @throws Exception for some failure scenarios.
      */
+//    @Test
 //    public void testCodec98NPE() throws Exception {
 //        byte[] codec98 = StringUtils.getBytesUtf8(Base32TestData.CODEC_98_NPE);
 //        ByteArrayInputStream data = new ByteArrayInputStream(codec98);
@@ -123,6 +122,7 @@ public class Base32InputStreamTest exten
      * @throws Exception
      *             for some failure scenarios.
      */
+    @Test
     public void testBase32EmptyInputStreamMimeChuckSize() throws Exception {
         testBase32EmptyInputStream(Base32.MIME_CHUNK_SIZE);
     }
@@ -133,6 +133,7 @@ public class Base32InputStreamTest exten
      * @throws Exception
      *             for some failure scenarios.
      */
+    @Test
     public void testBase32EmptyInputStreamPemChuckSize() throws Exception {
         testBase32EmptyInputStream(Base32.PEM_CHUNK_SIZE);
     }
@@ -150,6 +151,7 @@ public class Base32InputStreamTest exten
      * @throws Exception
      *             for some failure scenarios.
      */
+    @Test
     public void testBase32InputStreamByChunk() throws Exception {
         // Hello World test.
         byte[] encoded = StringUtils.getBytesUtf8(Base32TestData.BASE32_FIXTURE);
@@ -188,6 +190,7 @@ public class Base32InputStreamTest exten
      * @throws Exception
      *             for some failure scenarios.
      */
+    @Test
     public void testBase32InputStreamByteByByte() throws Exception {
         // Hello World test.
         byte[] encoded = StringUtils.getBytesUtf8(Base32TestData.BASE32_FIXTURE);
@@ -331,6 +334,7 @@ public class Base32InputStreamTest exten
      * 
      * @throws Exception
      */
+    @Test
     public void testMarkSupported() throws Exception {
         byte[] decoded = StringUtils.getBytesUtf8(Base32TestData.STRING_FIXTURE);
         ByteArrayInputStream bin = new ByteArrayInputStream(decoded);
@@ -344,6 +348,7 @@ public class Base32InputStreamTest exten
      * 
      * @throws Exception
      */
+    @Test
     public void testRead0() throws Exception {
         byte[] decoded = StringUtils.getBytesUtf8(Base32TestData.STRING_FIXTURE);
         byte[] buf = new byte[1024];
@@ -360,6 +365,7 @@ public class Base32InputStreamTest exten
      * @throws Exception
      *             for some failure scenarios.
      */
+    @Test
     public void testReadNull() throws Exception {
         byte[] decoded = StringUtils.getBytesUtf8(Base32TestData.STRING_FIXTURE);
         ByteArrayInputStream bin = new ByteArrayInputStream(decoded);
@@ -377,6 +383,7 @@ public class Base32InputStreamTest exten
      * 
      * @throws Exception
      */
+    @Test
     public void testReadOutOfBounds() throws Exception {
         byte[] decoded = StringUtils.getBytesUtf8(Base32TestData.STRING_FIXTURE);
         byte[] buf = new byte[1024];

Modified: commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32OutputStreamTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32OutputStreamTest.java?rev=1087894&r1=1087893&r2=1087894&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32OutputStreamTest.java (original)
+++ commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32OutputStreamTest.java Fri Apr  1 20:59:03 2011
@@ -17,27 +17,22 @@
 
 package org.apache.commons.codec.binary;
 
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.io.ByteArrayOutputStream;
 import java.io.OutputStream;
 import java.util.Arrays;
 
-import junit.framework.TestCase;
+import org.junit.Test;
 
-public class Base32OutputStreamTest extends TestCase {
+public class Base32OutputStreamTest {
 
     private final static byte[] CRLF = {(byte) '\r', (byte) '\n'};
 
     private final static byte[] LF = {(byte) '\n'};
 
-    /**
-     * Construct a new instance of this test case.
-     * 
-     * @param name
-     *            Name of the test case
-     */
-    public Base32OutputStreamTest(String name) {
-        super(name);
-    }
+    
 
 //    /**
 //     * Test the Base32OutputStream implementation against the special NPE inducing input
@@ -45,6 +40,7 @@ public class Base32OutputStreamTest exte
 //     *
 //     * @throws Exception for some failure scenarios.
 //     */
+//    @Test
 //    public void testCodec98NPE() throws Exception {
 //        byte[] codec98 = StringUtils.getBytesUtf8(Base32TestData.CODEC_98_NPE);
 //        byte[] codec98_1024 = new byte[1024];
@@ -68,6 +64,7 @@ public class Base32OutputStreamTest exte
      * @throws Exception
      *             for some failure scenarios.
      */
+    @Test
     public void testBase32EmptyOutputStreamMimeChunkSize() throws Exception {
         testBase32EmptyOutputStream(Base32.MIME_CHUNK_SIZE);
     }
@@ -78,6 +75,7 @@ public class Base32OutputStreamTest exte
      * @throws Exception
      *             for some failure scenarios.
      */
+    @Test
     public void testBase32EmptyOutputStreamPemChunkSize() throws Exception {
         testBase32EmptyOutputStream(Base32.PEM_CHUNK_SIZE);
     }
@@ -95,6 +93,7 @@ public class Base32OutputStreamTest exte
      * @throws Exception
      *             for some failure scenarios.
      */
+    @Test
     public void testBase32OutputStreamByChunk() throws Exception {
         // Hello World test.
         byte[] encoded = StringUtils.getBytesUtf8(Base32TestData.BASE32_FIXTURE);
@@ -129,6 +128,7 @@ public class Base32OutputStreamTest exte
      * @throws Exception
      *             for some failure scenarios.
      */
+    @Test
     public void testBase32OutputStreamByteByByte() throws Exception {
         // Hello World test.
         byte[] encoded = StringUtils.getBytesUtf8(Base32TestData.BASE32_FIXTURE);
@@ -280,6 +280,7 @@ public class Base32OutputStreamTest exte
      * @throws Exception
      *             for some failure scenarios.
      */
+    @Test
     public void testWriteOutOfBounds() throws Exception {
         byte[] buf = new byte[1024];
         ByteArrayOutputStream bout = new ByteArrayOutputStream();
@@ -320,6 +321,7 @@ public class Base32OutputStreamTest exte
      * @throws Exception
      *             for some failure scenarios.
      */
+    @Test
     public void testWriteToNullCoverage() throws Exception {
         ByteArrayOutputStream bout = new ByteArrayOutputStream();
         Base32OutputStream out = new Base32OutputStream(bout);

Modified: commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32Test.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32Test.java?rev=1087894&r1=1087893&r2=1087894&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32Test.java (original)
+++ commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32Test.java Fri Apr  1 20:59:03 2011
@@ -18,11 +18,14 @@
 
 package org.apache.commons.codec.binary;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
 import java.util.Arrays;
 
-import junit.framework.TestCase;
+import org.junit.Test;
 
-public class Base32Test extends TestCase {
+public class Base32Test {
     
     private static final String [][] BASE32_TEST_CASES = { // RFC 4648
         {""       ,""},
@@ -55,6 +58,7 @@ public class Base32Test extends TestCase
         {"foobar" ,"MZXW6YTBOI======\r\n"},
     };
 
+    @Test
     public void testBase32Samples() throws Exception {
         Base32 codec = new Base32();
         for (int i = 0; i < BASE32_TEST_CASES.length; i++) {
@@ -62,6 +66,7 @@ public class Base32Test extends TestCase
         }
     }
 
+    @Test
     public void testBase32HexSamples() throws Exception {
         Base32 codec = new Base32(true);
         for (int i = 0; i < BASE32HEX_TEST_CASES.length; i++) {
@@ -69,6 +74,7 @@ public class Base32Test extends TestCase
         }
     }
 
+    @Test
     public void testBase32Chunked () throws Exception {
         Base32 codec = new Base32(20);
         for (int i = 0; i < BASE32_TEST_CASES_CHUNKED.length; i++) {
@@ -76,6 +82,7 @@ public class Base32Test extends TestCase
         }        
     }
 
+    @Test
     public void testSingleCharEncoding() {
         for (int i = 0; i < 20; i++) {
             Base32 codec = new Base32();
@@ -94,6 +101,7 @@ public class Base32Test extends TestCase
         }
     }
 
+    @Test
     public void testRandomBytes() {
         for (int i = 0; i < 20; i++) {
             Base32 codec = new Base32();
@@ -102,6 +110,8 @@ public class Base32Test extends TestCase
             //assertEquals(b[0],codec.decode(b[1]));
         }
     }
+
+    @Test
     public void testRandomBytesChunked() {
         for (int i = 0; i < 20; i++) {
             Base32 codec = new Base32(10);
@@ -110,6 +120,8 @@ public class Base32Test extends TestCase
             //assertEquals(b[0],codec.decode(b[1]));
         }
     }
+    
+    @Test
     public void testRandomBytesHex() {
         for (int i = 0; i < 20; i++) {
             Base32 codec = new Base32(true);

Modified: commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64Codec13Test.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64Codec13Test.java?rev=1087894&r1=1087893&r2=1087894&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64Codec13Test.java (original)
+++ commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64Codec13Test.java Fri Apr  1 20:59:03 2011
@@ -17,20 +17,18 @@
 
 package org.apache.commons.codec.binary;
 
-import junit.framework.TestCase;
-import junit.framework.TestFailure;
-import junit.framework.TestResult;
-import junit.framework.TestSuite;
+import static org.junit.Assert.assertTrue;
+
+import java.io.UnsupportedEncodingException;
+import java.util.Arrays;
+
 import org.apache.commons.codec.BinaryDecoder;
 import org.apache.commons.codec.BinaryEncoder;
 import org.apache.commons.codec.Decoder;
 import org.apache.commons.codec.DecoderException;
 import org.apache.commons.codec.Encoder;
 import org.apache.commons.codec.EncoderException;
-
-import java.io.UnsupportedEncodingException;
-import java.util.Arrays;
-import java.util.Enumeration;
+import org.junit.Test;
 
 /**
  * Tests to make sure future versions of commons-codec.jar have identical Base64
@@ -39,11 +37,7 @@ import java.util.Enumeration;
  * @author Julius Davies
  * @since Mar 25, 2010
  */
-public class Base64Codec13Test extends TestCase {
-
-    public Base64Codec13Test(String name) {
-        super(name);
-    }
+public class Base64Codec13Test {
 
     private final static String[] STRINGS = new String[181];
     private final static String[] CHUNKED_STRINGS = new String[STRINGS.length];
@@ -368,6 +362,7 @@ public class Base64Codec13Test extends T
      * 
      * @throws EncoderException problem
      */
+    @Test
     public void testEncoder() throws EncoderException {
         Encoder enc = new Base64();
         for (int i = 0; i < STRINGS.length; i++) {
@@ -386,6 +381,7 @@ public class Base64Codec13Test extends T
      *
      * @throws DecoderException problem
      */    
+    @Test
     public void testDecoder() throws DecoderException {
         Decoder dec = new Base64();
         for (int i = 0; i < STRINGS.length; i++) {
@@ -404,6 +400,7 @@ public class Base64Codec13Test extends T
      *
      * @throws EncoderException problem
      */        
+    @Test
     public void testBinaryEncoder() throws EncoderException {
         BinaryEncoder enc = new Base64();
         for (int i = 0; i < STRINGS.length; i++) {
@@ -422,6 +419,7 @@ public class Base64Codec13Test extends T
      *
      * @throws DecoderException problem
      */    
+    @Test
     public void testBinaryDecoder() throws DecoderException {
         BinaryDecoder dec = new Base64();
         for (int i = 0; i < STRINGS.length; i++) {
@@ -440,6 +438,7 @@ public class Base64Codec13Test extends T
      *
      * @throws EncoderException problem
      */        
+    @Test
     public void testStaticEncode() throws EncoderException {
         for (int i = 0; i < STRINGS.length; i++) {
             if (STRINGS[i] != null) {
@@ -457,6 +456,7 @@ public class Base64Codec13Test extends T
      *
      * @throws DecoderException problem
      */            
+    @Test
     public void testStaticDecode() throws DecoderException {
         for (int i = 0; i < STRINGS.length; i++) {
             if (STRINGS[i] != null) {
@@ -474,6 +474,7 @@ public class Base64Codec13Test extends T
      *
      * @throws EncoderException problem
      */                
+    @Test
     public void testStaticEncodeChunked() throws EncoderException {
         for (int i = 0; i < STRINGS.length; i++) {
             if (STRINGS[i] != null) {
@@ -492,6 +493,7 @@ public class Base64Codec13Test extends T
      *
      * @throws DecoderException problem
      */                
+    @Test
     public void testStaticDecodeChunked() throws DecoderException {
         for (int i = 0; i < STRINGS.length; i++) {
             if (STRINGS[i] != null) {
@@ -515,36 +517,4 @@ public class Base64Codec13Test extends T
             throw new IllegalStateException(uee.toString());
         }
     }
-
-    /**
-     * This main() method can be run with just commons-codec-1.3.jar and junit-3.8.1.jar
-     * on the classpath to make sure these tests truly capture the behaviour of
-     * commons-codec-1.3.jar.
-     *
-     * @param args command-line args
-     */
-    public static void main(String[] args) {
-        TestSuite suite = new TestSuite(Base64Codec13Test.class);
-
-        TestResult r = new TestResult();
-        suite.run(r);
-        int runCount = r.runCount();
-        int failureCount = r.failureCount();
-        System.out.println((runCount - failureCount) + "/" + runCount + " tests succeeded!");
-        if (!r.wasSuccessful()) {
-            Enumeration en = r.errors();
-            while (en.hasMoreElements()) {
-                TestFailure tf = (TestFailure) en.nextElement();
-                System.out.println(tf.toString());
-            }
-
-            en = r.failures();
-            while (en.hasMoreElements()) {
-                TestFailure tf = (TestFailure) en.nextElement();
-                System.out.println(tf.toString());
-            }
-
-        }
-
-    }
 }

Modified: commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64InputStreamTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64InputStreamTest.java?rev=1087894&r1=1087893&r2=1087894&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64InputStreamTest.java (original)
+++ commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64InputStreamTest.java Fri Apr  1 20:59:03 2011
@@ -17,6 +17,12 @@
 
 package org.apache.commons.codec.binary;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.io.BufferedReader;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
@@ -24,14 +30,14 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.util.Arrays;
 
-import junit.framework.TestCase;
+import org.junit.Test;
 
 /**
  * @author Apache Software Foundation
  * @version $Id $
  * @since 1.4
  */
-public class Base64InputStreamTest extends TestCase {
+public class Base64InputStreamTest {
 
     private final static byte[] CRLF = {(byte) '\r', (byte) '\n'};
 
@@ -40,18 +46,9 @@ public class Base64InputStreamTest exten
     private static final String STRING_FIXTURE = "Hello World";
 
     /**
-     * Construct a new instance of this test case.
-     * 
-     * @param name
-     *            Name of the test case
-     */
-    public Base64InputStreamTest(String name) {
-        super(name);
-    }
-
-    /**
      * Tests the bug reported in CODEC-105. Bad interactions with InputStream when reading one byte at a time.
      */
+    @Test
     public void testCodec105() throws IOException {
         Base64InputStream in = new Base64InputStream(new Codec105ErrorInputStream(), true, 0, null);
         for (int i = 0; i < 5; i++) {
@@ -65,6 +62,7 @@ public class Base64InputStreamTest exten
      *
      * @throws Exception for some failure scenarios.
      */
+    @Test
     public void testCodec101() throws Exception {
         byte[] codec101 = StringUtils.getBytesUtf8(Base64TestData.CODEC_101_MULTIPLE_OF_3);
         ByteArrayInputStream bais = new ByteArrayInputStream(codec101);
@@ -96,6 +94,7 @@ public class Base64InputStreamTest exten
      *
      * @throws Exception for some failure scenarios.
      */
+    @Test
     public void testInputStreamReader() throws Exception {
         byte[] codec101 = StringUtils.getBytesUtf8(Base64TestData.CODEC_101_MULTIPLE_OF_3);
         ByteArrayInputStream bais = new ByteArrayInputStream(codec101);
@@ -112,6 +111,7 @@ public class Base64InputStreamTest exten
      *
      * @throws Exception for some failure scenarios.
      */
+    @Test
     public void testCodec98NPE() throws Exception {
         byte[] codec98 = StringUtils.getBytesUtf8(Base64TestData.CODEC_98_NPE);
         ByteArrayInputStream data = new ByteArrayInputStream(codec98);
@@ -132,6 +132,7 @@ public class Base64InputStreamTest exten
      * @throws Exception
      *             for some failure scenarios.
      */
+    @Test
     public void testBase64EmptyInputStreamMimeChuckSize() throws Exception {
         testBase64EmptyInputStream(Base64.MIME_CHUNK_SIZE);
     }
@@ -142,6 +143,7 @@ public class Base64InputStreamTest exten
      * @throws Exception
      *             for some failure scenarios.
      */
+    @Test
     public void testBase64EmptyInputStreamPemChuckSize() throws Exception {
         testBase64EmptyInputStream(Base64.PEM_CHUNK_SIZE);
     }
@@ -159,6 +161,7 @@ public class Base64InputStreamTest exten
      * @throws Exception
      *             for some failure scenarios.
      */
+    @Test
     public void testBase64InputStreamByChunk() throws Exception {
         // Hello World test.
         byte[] encoded = StringUtils.getBytesUtf8("SGVsbG8gV29ybGQ=\r\n");
@@ -196,6 +199,7 @@ public class Base64InputStreamTest exten
      * @throws Exception
      *             for some failure scenarios.
      */
+    @Test
     public void testBase64InputStreamByteByByte() throws Exception {
         // Hello World test.
         byte[] encoded = StringUtils.getBytesUtf8("SGVsbG8gV29ybGQ=\r\n");
@@ -343,6 +347,7 @@ public class Base64InputStreamTest exten
      * 
      * @throws Exception
      */
+    @Test
     public void testMarkSupported() throws Exception {
         byte[] decoded = StringUtils.getBytesUtf8(STRING_FIXTURE);
         ByteArrayInputStream bin = new ByteArrayInputStream(decoded);
@@ -356,6 +361,7 @@ public class Base64InputStreamTest exten
      * 
      * @throws Exception
      */
+    @Test
     public void testRead0() throws Exception {
         byte[] decoded = StringUtils.getBytesUtf8(STRING_FIXTURE);
         byte[] buf = new byte[1024];
@@ -372,6 +378,7 @@ public class Base64InputStreamTest exten
      * @throws Exception
      *             for some failure scenarios.
      */
+    @Test
     public void testReadNull() throws Exception {
         byte[] decoded = StringUtils.getBytesUtf8(STRING_FIXTURE);
         ByteArrayInputStream bin = new ByteArrayInputStream(decoded);
@@ -389,6 +396,7 @@ public class Base64InputStreamTest exten
      * 
      * @throws Exception
      */
+    @Test
     public void testReadOutOfBounds() throws Exception {
         byte[] decoded = StringUtils.getBytesUtf8(STRING_FIXTURE);
         byte[] buf = new byte[1024];

Modified: commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64OutputStreamTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64OutputStreamTest.java?rev=1087894&r1=1087893&r2=1087894&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64OutputStreamTest.java (original)
+++ commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64OutputStreamTest.java Fri Apr  1 20:59:03 2011
@@ -17,18 +17,22 @@
 
 package org.apache.commons.codec.binary;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.io.ByteArrayOutputStream;
 import java.io.OutputStream;
 import java.util.Arrays;
 
-import junit.framework.TestCase;
+import org.junit.Test;
 
 /**
  * @author Apache Software Foundation
  * @version $Id $
  * @since 1.4
  */
-public class Base64OutputStreamTest extends TestCase {
+public class Base64OutputStreamTest {
 
     private final static byte[] CRLF = {(byte) '\r', (byte) '\n'};
 
@@ -37,21 +41,12 @@ public class Base64OutputStreamTest exte
     private static final String STRING_FIXTURE = "Hello World";
 
     /**
-     * Construct a new instance of this test case.
-     * 
-     * @param name
-     *            Name of the test case
-     */
-    public Base64OutputStreamTest(String name) {
-        super(name);
-    }
-
-    /**
      * Test the Base64OutputStream implementation against the special NPE inducing input
      * identified in the CODEC-98 bug.
      *
      * @throws Exception for some failure scenarios.
      */
+    @Test
     public void testCodec98NPE() throws Exception {
         byte[] codec98 = StringUtils.getBytesUtf8(Base64TestData.CODEC_98_NPE);
         byte[] codec98_1024 = new byte[1024];
@@ -75,6 +70,7 @@ public class Base64OutputStreamTest exte
      * @throws Exception
      *             for some failure scenarios.
      */
+    @Test
     public void testBase64EmptyOutputStreamMimeChunkSize() throws Exception {
         testBase64EmptyOutputStream(Base64.MIME_CHUNK_SIZE);
     }
@@ -85,6 +81,7 @@ public class Base64OutputStreamTest exte
      * @throws Exception
      *             for some failure scenarios.
      */
+    @Test
     public void testBase64EmptyOutputStreamPemChunkSize() throws Exception {
         testBase64EmptyOutputStream(Base64.PEM_CHUNK_SIZE);
     }
@@ -102,6 +99,7 @@ public class Base64OutputStreamTest exte
      * @throws Exception
      *             for some failure scenarios.
      */
+    @Test
     public void testBase64OutputStreamByChunk() throws Exception {
         // Hello World test.
         byte[] encoded = StringUtils.getBytesUtf8("SGVsbG8gV29ybGQ=\r\n");
@@ -139,6 +137,7 @@ public class Base64OutputStreamTest exte
      * @throws Exception
      *             for some failure scenarios.
      */
+    @Test
     public void testBase64OutputStreamByteByByte() throws Exception {
         // Hello World test.
         byte[] encoded = StringUtils.getBytesUtf8("SGVsbG8gV29ybGQ=\r\n");
@@ -293,6 +292,7 @@ public class Base64OutputStreamTest exte
      * @throws Exception
      *             for some failure scenarios.
      */
+    @Test
     public void testWriteOutOfBounds() throws Exception {
         byte[] buf = new byte[1024];
         ByteArrayOutputStream bout = new ByteArrayOutputStream();
@@ -333,6 +333,7 @@ public class Base64OutputStreamTest exte
      * @throws Exception
      *             for some failure scenarios.
      */
+    @Test
     public void testWriteToNullCoverage() throws Exception {
         ByteArrayOutputStream bout = new ByteArrayOutputStream();
         Base64OutputStream out = new Base64OutputStream(bout);

Modified: commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64Test.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64Test.java?rev=1087894&r1=1087893&r2=1087894&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64Test.java (original)
+++ commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64Test.java Fri Apr  1 20:59:03 2011
@@ -17,15 +17,20 @@
 
 package org.apache.commons.codec.binary;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.io.UnsupportedEncodingException;
 import java.math.BigInteger;
 import java.util.Arrays;
 import java.util.Random;
 
-import junit.framework.TestCase;
-
 import org.apache.commons.codec.DecoderException;
 import org.apache.commons.codec.EncoderException;
+import org.junit.Test;
 
 /**
  * Test cases for Base64 class.
@@ -34,21 +39,11 @@ import org.apache.commons.codec.EncoderE
  * @author Apache Software Foundation
  * @version $Id$
  */
-public class Base64Test extends TestCase {
+public class Base64Test {
 
     private Random _random = new Random();
 
     /**
-     * Construct a new instance of this test case.
-     * 
-     * @param name
-     *            Name of the test case
-     */
-    public Base64Test(String name) {
-        super(name);
-    }
-
-    /**
      * @return Returns the _random.
      */
     public Random getRandom() {
@@ -58,6 +53,7 @@ public class Base64Test extends TestCase
     /**
      * Test the isStringBase64 method.
      */
+    @Test
     public void testIsStringBase64() {
         String nullString = null;
         String emptyString = "";
@@ -79,6 +75,7 @@ public class Base64Test extends TestCase
     /**
      * Test the Base64 implementation
      */
+    @Test
     public void testBase64() {
         String content = "Hello World";
         String encodedContent;
@@ -105,6 +102,7 @@ public class Base64Test extends TestCase
     /**
      * Tests Base64.encodeBase64().
      */
+    @Test
     public void testChunkedEncodeMultipleOf76() {
         byte[] expectedEncode = Base64.encodeBase64(Base64TestData.DECODED, true);
         // convert to "\r\n" so we're equal to the old openssl encoding test stored
@@ -117,11 +115,13 @@ public class Base64Test extends TestCase
     /**
      * CODEC-68: isBase64 throws ArrayIndexOutOfBoundsException on some non-BASE64 bytes
      */
+    @Test
     public void testCodec68() {
         byte[] x = new byte[]{'n', 'A', '=', '=', (byte) 0x9c};
         Base64.decodeBase64(x);
     }
 
+    @Test
     public void testCodeInteger1() throws UnsupportedEncodingException {
         String encodedInt1 = "li7dzDacuo67Jg7mtqEm2TRuOMU=";
         BigInteger bigInt1 = new BigInteger("85739377120809420210425962799" + "0318636601332086981");
@@ -130,6 +130,7 @@ public class Base64Test extends TestCase
         assertEquals(bigInt1, Base64.decodeInteger(encodedInt1.getBytes("UTF-8")));
     }
 
+    @Test
     public void testCodeInteger2() throws UnsupportedEncodingException {
         String encodedInt2 = "9B5ypLY9pMOmtxCeTDHgwdNFeGs=";
         BigInteger bigInt2 = new BigInteger("13936727572861167254666467268" + "91466679477132949611");
@@ -138,6 +139,7 @@ public class Base64Test extends TestCase
         assertEquals(bigInt2, Base64.decodeInteger(encodedInt2.getBytes("UTF-8")));
     }
 
+    @Test
     public void testCodeInteger3() throws UnsupportedEncodingException {
         String encodedInt3 = "FKIhdgaG5LGKiEtF1vHy4f3y700zaD6QwDS3IrNVGzNp2" + "rY+1LFWTK6D44AyiC1n8uWz1itkYMZF0/aKDK0Yjg==";
         BigInteger bigInt3 = new BigInteger("10806548154093873461951748545"
@@ -148,6 +150,7 @@ public class Base64Test extends TestCase
         assertEquals(bigInt3, Base64.decodeInteger(encodedInt3.getBytes("UTF-8")));
     }
 
+    @Test
     public void testCodeInteger4() throws UnsupportedEncodingException {
         String encodedInt4 = "ctA8YGxrtngg/zKVvqEOefnwmViFztcnPBYPlJsvh6yKI"
             + "4iDm68fnp4Mi3RrJ6bZAygFrUIQLxLjV+OJtgJAEto0xAs+Mehuq1DkSFEpP3o"
@@ -164,10 +167,12 @@ public class Base64Test extends TestCase
         assertEquals(bigInt4, Base64.decodeInteger(encodedInt4.getBytes("UTF-8")));
     }
 
+    @Test
     public void testCodeIntegerEdgeCases() {
         // TODO
     }
 
+    @Test
     public void testCodeIntegerNull() {
         try {
             Base64.encodeInteger(null);
@@ -179,6 +184,7 @@ public class Base64Test extends TestCase
         }
     }
 
+    @Test
     public void testConstructors() {
         Base64 base64;
         base64 = new Base64();
@@ -214,6 +220,7 @@ public class Base64Test extends TestCase
         assertNotNull(base64);
     }
 
+    @Test
     public void testConstructor_Int_ByteArray_Boolean() {
         Base64 base64 = new Base64(65, new byte[]{'\t'}, false);
         byte[] encoded = base64.encode(Base64TestData.DECODED);
@@ -223,6 +230,7 @@ public class Base64Test extends TestCase
         assertEquals("new Base64(65, \\t, false)", expectedResult, result);
     }
 
+    @Test
     public void testConstructor_Int_ByteArray_Boolean_UrlSafe() {
         // url-safe variation
         Base64 base64 = new Base64(64, new byte[]{'\t'}, true);
@@ -239,6 +247,7 @@ public class Base64Test extends TestCase
     /**
      * Tests conditional true branch for "marker0" test.
      */
+    @Test
     public void testDecodePadMarkerIndex2() throws UnsupportedEncodingException {
         assertEquals("A", new String(Base64.decodeBase64("QQ==".getBytes("UTF-8"))));
     }
@@ -246,11 +255,13 @@ public class Base64Test extends TestCase
     /**
      * Tests conditional branches for "marker1" test.
      */
+    @Test
     public void testDecodePadMarkerIndex3() throws UnsupportedEncodingException {
         assertEquals("AA", new String(Base64.decodeBase64("QUE=".getBytes("UTF-8"))));
         assertEquals("AAA", new String(Base64.decodeBase64("QUFB".getBytes("UTF-8"))));
     }
 
+    @Test
     public void testDecodePadOnly() throws UnsupportedEncodingException {
         assertTrue(Base64.decodeBase64("====".getBytes("UTF-8")).length == 0);
         assertEquals("", new String(Base64.decodeBase64("====".getBytes("UTF-8"))));
@@ -261,6 +272,7 @@ public class Base64Test extends TestCase
         assertTrue(Base64.decodeBase64("".getBytes("UTF-8")).length == 0);
     }
 
+    @Test
     public void testDecodePadOnlyChunked() throws UnsupportedEncodingException {
         assertTrue(Base64.decodeBase64("====\n".getBytes("UTF-8")).length == 0);
         assertEquals("", new String(Base64.decodeBase64("====\n".getBytes("UTF-8"))));
@@ -271,6 +283,7 @@ public class Base64Test extends TestCase
         assertTrue(Base64.decodeBase64("\n".getBytes("UTF-8")).length == 0);
     }
 
+    @Test
     public void testDecodeWithWhitespace() throws Exception {
 
         String orig = "I am a late night coder.";
@@ -294,6 +307,7 @@ public class Base64Test extends TestCase
     /**
      * Test encode and decode of empty byte array.
      */
+    @Test
     public void testEmptyBase64() {
         byte[] empty = new byte[0];
         byte[] result = Base64.encodeBase64(empty);
@@ -307,6 +321,7 @@ public class Base64Test extends TestCase
     }
 
     // encode/decode a large random array
+    @Test
     public void testEncodeDecodeRandom() {
         for (int i = 1; i < 5; i++) {
             byte[] data = new byte[this.getRandom().nextInt(10000) + 1];
@@ -319,6 +334,7 @@ public class Base64Test extends TestCase
     }
 
     // encode/decode random arrays from size 0 to size 11
+    @Test
     public void testEncodeDecodeSmall() {
         for (int i = 0; i < 12; i++) {
             byte[] data = new byte[i];
@@ -330,6 +346,7 @@ public class Base64Test extends TestCase
         }
     }
 
+    @Test
     public void testEncodeOverMaxSize() throws Exception {
         testEncodeOverMaxSize(-1);
         testEncodeOverMaxSize(0);
@@ -337,6 +354,7 @@ public class Base64Test extends TestCase
         testEncodeOverMaxSize(2);
     }
     
+    @Test
     public void testCodec112() { // size calculation assumes always chunked
         byte[] in = new byte[] {0};
         byte[] out=Base64.encodeBase64(in);
@@ -352,11 +370,13 @@ public class Base64Test extends TestCase
         }
     }
 
+    @Test
     public void testIgnoringNonBase64InDecode() throws Exception {
         assertEquals("The quick brown fox jumped over the lazy dogs.", new String(Base64
                 .decodeBase64("VGhlIH@$#$@%F1aWN@#@#@@rIGJyb3duIGZve\n\r\t%#%#%#%CBqd##$#$W1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg==".getBytes("UTF-8"))));
     }
 
+    @Test
     public void testIsArrayByteBase64() {
         assertFalse(Base64.isBase64(new byte[]{Byte.MIN_VALUE}));
         assertFalse(Base64.isBase64(new byte[]{-125}));
@@ -374,6 +394,7 @@ public class Base64Test extends TestCase
     /**
      * Tests isUrlSafe.
      */
+    @Test
     public void testIsUrlSafe() {
         Base64 base64Standard = new Base64(false);
         Base64 base64URLSafe = new Base64(true);
@@ -385,6 +406,7 @@ public class Base64Test extends TestCase
         assertTrue("Base64.isBase64(whiteSpace)=true", Base64.isBase64(whiteSpace));
     }
 
+    @Test
     public void testKnownDecodings() throws UnsupportedEncodingException {
         assertEquals("The quick brown fox jumped over the lazy dogs.", new String(Base64
                 .decodeBase64("VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg==".getBytes("UTF-8"))));
@@ -399,6 +421,7 @@ public class Base64Test extends TestCase
         assertEquals("xyzzy!", new String(Base64.decodeBase64("eHl6enkh".getBytes("UTF-8"))));
     }
 
+    @Test
     public void testKnownEncodings() throws UnsupportedEncodingException {
         assertEquals("VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg==", new String(Base64
                 .encodeBase64("The quick brown fox jumped over the lazy dogs.".getBytes("UTF-8"))));
@@ -419,6 +442,7 @@ public class Base64Test extends TestCase
         assertEquals("eHl6enkh", new String(Base64.encodeBase64("xyzzy!".getBytes("UTF-8"))));
     }
 
+    @Test
     public void testNonBase64Test() throws Exception {
 
         byte[] bArray = {'%'};
@@ -440,6 +464,7 @@ public class Base64Test extends TestCase
         }
     }
 
+    @Test
     public void testObjectDecodeWithInvalidParameter() throws Exception {
         Base64 b64 = new Base64();
 
@@ -452,6 +477,7 @@ public class Base64Test extends TestCase
 
     }
 
+    @Test
     public void testObjectDecodeWithValidParameter() throws Exception {
 
         String original = "Hello World!";
@@ -465,6 +491,7 @@ public class Base64Test extends TestCase
         assertTrue("dest string does not equal original", dest.equals(original));
     }
 
+    @Test
     public void testObjectEncodeWithInvalidParameter() throws Exception {
         Base64 b64 = new Base64();
         try {
@@ -475,6 +502,7 @@ public class Base64Test extends TestCase
         }
     }
 
+    @Test
     public void testObjectEncodeWithValidParameter() throws Exception {
 
         String original = "Hello World!";
@@ -488,11 +516,13 @@ public class Base64Test extends TestCase
         assertTrue("dest string does not equal original", dest.equals(original));
     }
 
+    @Test
     public void testObjectEncode() throws Exception {
         Base64 b64 = new Base64();
         assertEquals("SGVsbG8gV29ybGQ=", new String(b64.encode("Hello World".getBytes("UTF-8"))));
     }
 
+    @Test
     public void testPairs() {
         assertEquals("AAA=", new String(Base64.encodeBase64(new byte[]{0, 0})));
         for (int i = -128; i <= 127; i++) {
@@ -504,6 +534,7 @@ public class Base64Test extends TestCase
     /**
      * Tests RFC 2045 section 2.1 CRLF definition.
      */
+    @Test
     public void testRfc2045Section2Dot1CrLfDefinition() {
         assertTrue(Arrays.equals(new byte[]{13, 10}, Base64.CHUNK_SEPARATOR));
     }
@@ -511,6 +542,7 @@ public class Base64Test extends TestCase
     /**
      * Tests RFC 2045 section 6.8 chuck size definition.
      */
+    @Test
     public void testRfc2045Section6Dot8ChunkSizeDefinition() {
         assertEquals(76, Base64.MIME_CHUNK_SIZE);
     }
@@ -518,6 +550,7 @@ public class Base64Test extends TestCase
     /**
      * Tests RFC 1421 section 4.3.2.4 chuck size definition.
      */
+    @Test
     public void testRfc1421Section6Dot8ChunkSizeDefinition() {
         assertEquals(64, Base64.PEM_CHUNK_SIZE);
     }
@@ -536,6 +569,7 @@ public class Base64Test extends TestCase
      * 
      * @see <a href="http://tools.ietf.org/html/rfc4648">http://tools.ietf.org/html/rfc4648</a>
      */
+    @Test
     public void testRfc4648Section10Decode() {
         assertEquals("", StringUtils.newStringUsAscii(Base64.decodeBase64("")));
         assertEquals("f", StringUtils.newStringUsAscii(Base64.decodeBase64("Zg==")));
@@ -560,6 +594,7 @@ public class Base64Test extends TestCase
      * 
      * @see <a href="http://tools.ietf.org/html/rfc4648">http://tools.ietf.org/html/rfc4648</a>
      */
+    @Test
     public void testRfc4648Section10DecodeWithCrLf() {
         String CRLF = StringUtils.newStringUsAscii(Base64.CHUNK_SEPARATOR);
         assertEquals("", StringUtils.newStringUsAscii(Base64.decodeBase64("" + CRLF)));
@@ -585,6 +620,7 @@ public class Base64Test extends TestCase
      * 
      * @see <a href="http://tools.ietf.org/html/rfc4648">http://tools.ietf.org/html/rfc4648</a>
      */
+    @Test
     public void testRfc4648Section10Encode() {
         assertEquals("", Base64.encodeBase64String(StringUtils.getBytesUtf8("")));
         assertEquals("Zg==", Base64.encodeBase64String(StringUtils.getBytesUtf8("f")));
@@ -609,6 +645,7 @@ public class Base64Test extends TestCase
      * 
      * @see <a href="http://tools.ietf.org/html/rfc4648">http://tools.ietf.org/html/rfc4648</a>
      */
+    @Test
     public void testRfc4648Section10DecodeEncode() {
         testDecodeEncode("");
         //testDecodeEncode("Zg==");
@@ -639,6 +676,7 @@ public class Base64Test extends TestCase
      * 
      * @see <a href="http://tools.ietf.org/html/rfc4648">http://tools.ietf.org/html/rfc4648</a>
      */
+    @Test
     public void testRfc4648Section10EncodeDecode() {
         testEncodeDecode("");
         testEncodeDecode("f");
@@ -655,6 +693,7 @@ public class Base64Test extends TestCase
         assertEquals(plainText, decodedText);
     }
     
+    @Test
     public void testSingletons() {
         assertEquals("AA==", new String(Base64.encodeBase64(new byte[]{(byte) 0})));
         assertEquals("AQ==", new String(Base64.encodeBase64(new byte[]{(byte) 1})));
@@ -767,6 +806,7 @@ public class Base64Test extends TestCase
         }
     }
 
+    @Test
     public void testSingletonsChunked() {
         assertEquals("AA==\r\n", new String(Base64.encodeBase64Chunked(new byte[]{(byte) 0})));
         assertEquals("AQ==\r\n", new String(Base64.encodeBase64Chunked(new byte[]{(byte) 1})));
@@ -875,6 +915,7 @@ public class Base64Test extends TestCase
         assertEquals("aA==\r\n", new String(Base64.encodeBase64Chunked(new byte[]{(byte) 104})));
     }
 
+    @Test
     public void testTriplets() {
         assertEquals("AAAA", new String(Base64.encodeBase64(new byte[]{(byte) 0, (byte) 0, (byte) 0})));
         assertEquals("AAAB", new String(Base64.encodeBase64(new byte[]{(byte) 0, (byte) 0, (byte) 1})));
@@ -942,6 +983,7 @@ public class Base64Test extends TestCase
         assertEquals("AAA/", new String(Base64.encodeBase64(new byte[]{(byte) 0, (byte) 0, (byte) 63})));
     }
 
+    @Test
     public void testTripletsChunked() {
         assertEquals("AAAA\r\n", new String(Base64.encodeBase64Chunked(new byte[]{(byte) 0, (byte) 0, (byte) 0})));
         assertEquals("AAAB\r\n", new String(Base64.encodeBase64Chunked(new byte[]{(byte) 0, (byte) 0, (byte) 1})));
@@ -1012,6 +1054,7 @@ public class Base64Test extends TestCase
     /**
      * Tests url-safe Base64 against random data, sizes 0 to 150.
      */
+    @Test
     public void testUrlSafe() {
         // test random data of sizes 0 thru 150
         for (int i = 0; i <= 150; i++) {
@@ -1034,6 +1077,7 @@ public class Base64Test extends TestCase
      * @throws DecoderException
      *             if Hex.decode() fails - a serious problem since Hex comes from our own commons-codec!
      */
+    @Test
     public void testUUID() throws DecoderException {
         // The 4 UUID's below contains mixtures of + and / to help us test the
         // URL-SAFE encoding mode.
@@ -1122,6 +1166,7 @@ public class Base64Test extends TestCase
         }
     }
 
+    @Test
     public void testByteToStringVariations() throws DecoderException {
         Base64 base64 = new Base64(0);
         byte[] b1 = StringUtils.getBytesUtf8("Hello World");
@@ -1140,6 +1185,7 @@ public class Base64Test extends TestCase
         assertEquals("byteToString static-url-safe UUID", "K_fMJwH-Q5e0nr7tWsxwkA", Base64.encodeBase64URLSafeString(b4));
     }
 
+    @Test
     public void testStringToByteVariations() throws DecoderException {
         Base64 base64 = new Base64();
         String s1 = "SGVsbG8gV29ybGQ=\r\n";

Modified: commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/BaseNCodecTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/BaseNCodecTest.java?rev=1087894&r1=1087893&r2=1087894&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/BaseNCodecTest.java (original)
+++ commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/BaseNCodecTest.java Fri Apr  1 20:59:03 2011
@@ -18,13 +18,19 @@
 
 package org.apache.commons.codec.binary;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
-public class BaseNCodecTest extends TestCase {
+import org.junit.Before;
+import org.junit.Test;
+
+public class BaseNCodecTest {
 
     BaseNCodec codec;
     
-    public void setUp(){
+    @Before
+    public void setUp() {
         codec = new BaseNCodec(0, 0, 0, 0) {
             protected boolean isInAlphabet(byte b) {
                 return b=='O' || b == 'K'; // allow OK
@@ -38,26 +44,32 @@ public class BaseNCodecTest extends Test
         };        
     }
 
+    @Test
     public void testBaseNCodec() {
         assertNotNull(codec);
     }
 
+//    @Test
 //    public void testHasData() {
 //        fail("Not yet implemented");
 //    }
 //
+//    @Test
 //    public void testAvail() {
 //        fail("Not yet implemented");
 //    }
 //
+//    @Test
 //    public void testEnsureBufferSize() {
 //        fail("Not yet implemented");
 //    }
 //
+//    @Test
 //    public void testReadResults() {
 //        fail("Not yet implemented");
 //    }
 //
+    @Test
     public void testIsWhiteSpace() {
         assertTrue(BaseNCodec.isWhiteSpace((byte) ' '));
         assertTrue(BaseNCodec.isWhiteSpace((byte) '\n'));
@@ -65,42 +77,52 @@ public class BaseNCodecTest extends Test
         assertTrue(BaseNCodec.isWhiteSpace((byte) '\t'));
     }
 //
+//    @Test
 //    public void testEncodeObject() {
 //        fail("Not yet implemented");
 //    }
 //
+//    @Test
 //    public void testEncodeToString() {
 //        fail("Not yet implemented");
 //    }
 //
+//    @Test
 //    public void testDecodeObject() {
 //        fail("Not yet implemented");
 //    }
 //
+//    @Test
 //    public void testDecodeString() {
 //        fail("Not yet implemented");
 //    }
 //
+//    @Test
 //    public void testDecodeByteArray() {
 //        fail("Not yet implemented");
 //    }
 //
+//    @Test
 //    public void testEncodeByteArray() {
 //        fail("Not yet implemented");
 //    }
 //
+//    @Test
 //    public void testEncodeAsString() {
 //        fail("Not yet implemented");
 //    }
 //
+//    @Test
 //    public void testEncodeByteArrayIntInt() {
 //        fail("Not yet implemented");
 //    }
 //
+//    @Test
 //    public void testDecodeByteArrayIntInt() {
 //        fail("Not yet implemented");
 //    }
 //
+    @Test
     public void testIsInAlphabetByte() {
         assertFalse(codec.isInAlphabet((byte) 0));
         assertFalse(codec.isInAlphabet((byte) 'a'));
@@ -108,6 +130,7 @@ public class BaseNCodecTest extends Test
         assertTrue(codec.isInAlphabet((byte) 'K'));
     }
 
+    @Test
     public void testIsInAlphabetByteArrayBoolean() {
         assertTrue(codec.isInAlphabet(new byte[]{}, false));
         assertTrue(codec.isInAlphabet(new byte[]{'O'}, false));
@@ -119,11 +142,13 @@ public class BaseNCodecTest extends Test
         assertTrue(codec.isInAlphabet(new byte[]{' '}, true));
     }
 
+    @Test
     public void testIsInAlphabetString() {
         assertTrue(codec.isInAlphabet("OK"));
         assertTrue(codec.isInAlphabet("O=K= \t\n\r"));
     }
 
+    @Test
     public void testContainsAlphabetOrPad() {
         assertFalse(codec.containsAlphabetOrPad(null));
         assertFalse(codec.containsAlphabetOrPad(new byte[]{}));
@@ -133,6 +158,7 @@ public class BaseNCodecTest extends Test
         assertTrue(codec.containsAlphabetOrPad(new byte[]{codec.PAD}));
     }
 
+//    @Test
 //    public void testGetEncodedLength() {
 //        fail("Not yet implemented");
 //    }

Modified: commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/BinaryCodecTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/BinaryCodecTest.java?rev=1087894&r1=1087893&r2=1087894&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/BinaryCodecTest.java (original)
+++ commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/BinaryCodecTest.java Fri Apr  1 20:59:03 2011
@@ -17,12 +17,16 @@
 
 package org.apache.commons.codec.binary;
 
-import java.io.UnsupportedEncodingException;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
 
-import junit.framework.TestCase;
+import java.io.UnsupportedEncodingException;
 
 import org.apache.commons.codec.DecoderException;
 import org.apache.commons.codec.EncoderException;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * TestCase for BinaryCodec class.
@@ -30,7 +34,7 @@ import org.apache.commons.codec.EncoderE
  * @author Apache Software Foundation
  * @version $Id$
  */
-public class BinaryCodecTest extends TestCase {
+public class BinaryCodecTest {
     /** mask with bit zero based index 0 raised */
     private static final int BIT_0 = 0x01;
 
@@ -58,31 +62,16 @@ public class BinaryCodecTest extends Tes
     /** an instance of the binary codec */
     BinaryCodec instance = null;
 
-    /*
-     * @see TestCase#setUp()
-     */
-    protected void setUp() throws Exception {
-        super.setUp();
+    @Before
+    public void setUp() throws Exception {
         this.instance = new BinaryCodec();
     }
 
-    /*
-     * @see TestCase#tearDown()
-     */
-    protected void tearDown() throws Exception {
-        super.tearDown();
+    @After
+    public void tearDown() throws Exception {
         this.instance = null;
     }
 
-    /**
-     * Constructor for BinaryTest.
-     * 
-     * @param arg0
-     */
-    public BinaryCodecTest(String arg0) {
-        super(arg0);
-    }
-
     // ------------------------------------------------------------------------
     //
     // Test decode(Object)
@@ -91,6 +80,7 @@ public class BinaryCodecTest extends Tes
     /**
      * Tests for Object decode(Object)
      */
+    @Test
     public void testDecodeObjectException() {
         try {
             this.instance.decode(new Object());
@@ -104,6 +94,7 @@ public class BinaryCodecTest extends Tes
     /**
      * Tests for Object decode(Object)
      */
+    @Test
     public void testDecodeObject() throws Exception {
         byte[] bits;
         // With a single raw binary
@@ -206,6 +197,7 @@ public class BinaryCodecTest extends Tes
     /*
      * Tests for byte[] decode(byte[])
      */
+    @Test
     public void testDecodeByteArray() throws UnsupportedEncodingException {
         // With a single raw binary
         byte[] bits = new byte[1];
@@ -298,6 +290,7 @@ public class BinaryCodecTest extends Tes
     /*
      * Tests for byte[] toByteArray(String)
      */
+    @Test
     public void testToByteArrayFromString() {
         // With a single raw binary
         byte[] bits = new byte[1];
@@ -391,6 +384,7 @@ public class BinaryCodecTest extends Tes
     /*
      * Tests for byte[] fromAscii(char[])
      */
+    @Test
     public void testFromAsciiCharArray() {
         assertEquals(0, BinaryCodec.fromAscii((char[]) null).length);
         assertEquals(0, BinaryCodec.fromAscii(new char[0]).length);
@@ -486,6 +480,7 @@ public class BinaryCodecTest extends Tes
     /*
      * Tests for byte[] fromAscii(byte[])
      */
+    @Test
     public void testFromAsciiByteArray() throws UnsupportedEncodingException {
         assertEquals(0, BinaryCodec.fromAscii((byte[]) null).length);
         assertEquals(0, BinaryCodec.fromAscii(new byte[0]).length);
@@ -581,6 +576,7 @@ public class BinaryCodecTest extends Tes
     /*
      * Tests for byte[] encode(byte[])
      */
+    @Test
     public void testEncodeByteArray() {
         // With a single raw binary
         byte[] bits = new byte[1];
@@ -703,6 +699,7 @@ public class BinaryCodecTest extends Tes
     // Test toAsciiBytes
     //
     // ------------------------------------------------------------------------
+    @Test
     public void testToAsciiBytes() {
         // With a single raw binary
         byte[] bits = new byte[1];
@@ -825,6 +822,7 @@ public class BinaryCodecTest extends Tes
     // Test toAsciiChars
     //
     // ------------------------------------------------------------------------
+    @Test
     public void testToAsciiChars() {
         // With a single raw binary
         byte[] bits = new byte[1];
@@ -950,6 +948,7 @@ public class BinaryCodecTest extends Tes
     /**
      * Tests the toAsciiString(byte[]) method
      */
+    @Test
     public void testToAsciiString() {
         // With a single raw binary
         byte[] bits = new byte[1];
@@ -1074,6 +1073,7 @@ public class BinaryCodecTest extends Tes
     /*
      * Tests for Object encode(Object)
      */
+    @Test
     public void testEncodeObjectNull() throws Exception {
         Object obj = new byte[0];
         assertEquals(0, ((char[]) instance.encode(obj)).length);
@@ -1082,6 +1082,7 @@ public class BinaryCodecTest extends Tes
     /*
      * Tests for Object encode(Object)
      */
+    @Test
     public void testEncodeObjectException() {
         try {
             instance.encode("");
@@ -1095,6 +1096,7 @@ public class BinaryCodecTest extends Tes
     /*
      * Tests for Object encode(Object)
      */
+    @Test
     public void testEncodeObject() throws Exception {
         // With a single raw binary
         byte[] bits = new byte[1];

Modified: commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/HexTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/HexTest.java?rev=1087894&r1=1087893&r2=1087894&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/HexTest.java (original)
+++ commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/HexTest.java Fri Apr  1 20:59:03 2011
@@ -17,6 +17,11 @@
 
 package org.apache.commons.codec.binary;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.io.UnsupportedEncodingException;
 import java.nio.charset.Charset;
 import java.util.Arrays;
@@ -26,10 +31,10 @@ import java.util.Set;
 import java.util.SortedMap;
 
 import junit.framework.Assert;
-import junit.framework.TestCase;
 
 import org.apache.commons.codec.DecoderException;
 import org.apache.commons.codec.EncoderException;
+import org.junit.Test;
 
 /**
  * Tests {@link org.apache.commons.codec.binary.Hex}.
@@ -37,16 +42,12 @@ import org.apache.commons.codec.EncoderE
  * @author Apache Software Foundation
  * @version $Id$
  */
-public class HexTest extends TestCase {
+public class HexTest {
 
     private static final String BAD_ENCODING_NAME = "UNKNOWN";
     
     private final static boolean LOG = false;
 
-    public HexTest(String name) {
-        super(name);
-    }
-
     private boolean charsetSanityCheck(String name) {
         final String source = "the quick brown dog jumped over the lazy fox";
         try {
@@ -123,6 +124,7 @@ public class HexTest extends TestCase {
         }
     }
 
+    @Test
     public void testCustomCharset() throws UnsupportedEncodingException, DecoderException {
         SortedMap map = Charset.availableCharsets();
         Set keys = map.keySet();
@@ -175,6 +177,7 @@ public class HexTest extends TestCase {
         assertEquals(name, sourceString, actualStringFromBytes);
     }
 
+    @Test
     public void testCustomCharsetBadNameEncodeByteArray() throws UnsupportedEncodingException {
         try {
             new Hex(BAD_ENCODING_NAME).encode("Hello World".getBytes("UTF-8"));
@@ -184,6 +187,7 @@ public class HexTest extends TestCase {
         }
     }
 
+    @Test
     public void testCustomCharsetBadNameEncodeObject() {
         try {
             new Hex(BAD_ENCODING_NAME).encode("Hello World");
@@ -193,6 +197,7 @@ public class HexTest extends TestCase {
         }
     }
 
+    @Test
     public void testCustomCharsetBadNameDecodeObject() throws UnsupportedEncodingException {
         try {
             new Hex(BAD_ENCODING_NAME).decode("Hello World".getBytes("UTF-8"));
@@ -202,10 +207,12 @@ public class HexTest extends TestCase {
         }
     }
 
+    @Test
     public void testCustomCharsetToString() {
         assertTrue(new Hex().toString().indexOf(Hex.DEFAULT_CHARSET_NAME) >= 0);
     }
 
+    @Test
     public void testDecodeArrayOddCharacters() {
         try {
             new Hex().decode(new byte[]{65});
@@ -215,6 +222,7 @@ public class HexTest extends TestCase {
         }
     }
 
+    @Test
     public void testDecodeBadCharacterPos0() {
         try {
             new Hex().decode("q0");
@@ -224,6 +232,7 @@ public class HexTest extends TestCase {
         }
     }
 
+    @Test
     public void testDecodeBadCharacterPos1() {
         try {
             new Hex().decode("0q");
@@ -233,6 +242,7 @@ public class HexTest extends TestCase {
         }
     }
 
+    @Test
     public void testDecodeClassCastException() {
         try {
             new Hex().decode(new int[]{65});
@@ -242,18 +252,22 @@ public class HexTest extends TestCase {
         }
     }
 
+    @Test
     public void testDecodeHexOddCharacters1() {
         checkDecodeHexOddCharacters(new char[]{'A'});
     }
 
+    @Test
     public void testDecodeHexOddCharacters3() {
         checkDecodeHexOddCharacters(new char[]{'A', 'B', 'C'});
     }
 
+    @Test
     public void testDecodeHexOddCharacters5() {
         checkDecodeHexOddCharacters(new char[]{'A', 'B', 'C', 'D', 'E'});
     }
 
+    @Test
     public void testDecodeStringOddCharacters() {
         try {
             new Hex().decode("6");
@@ -263,12 +277,14 @@ public class HexTest extends TestCase {
         }
     }
 
+    @Test
     public void testDencodeEmpty() throws DecoderException {
         assertTrue(Arrays.equals(new byte[0], Hex.decodeHex(new char[0])));
         assertTrue(Arrays.equals(new byte[0], new Hex().decode(new byte[0])));
         assertTrue(Arrays.equals(new byte[0], (byte[]) new Hex().decode("")));
     }
 
+    @Test
     public void testEncodeClassCastException() {
         try {
             new Hex().encode(new int[]{65});
@@ -278,6 +294,7 @@ public class HexTest extends TestCase {
         }
     }
 
+    @Test
     public void testEncodeDecodeRandom() throws DecoderException, EncoderException {
         Random random = new Random();
 
@@ -310,17 +327,20 @@ public class HexTest extends TestCase {
         }
     }
 
+    @Test
     public void testEncodeEmpty() throws EncoderException {
         assertTrue(Arrays.equals(new char[0], Hex.encodeHex(new byte[0])));
         assertTrue(Arrays.equals(new byte[0], new Hex().encode(new byte[0])));
         assertTrue(Arrays.equals(new char[0], (char[]) new Hex().encode("")));
     }
 
+    @Test
     public void testEncodeZeroes() {
         char[] c = Hex.encodeHex(new byte[36]);
         assertEquals("000000000000000000000000000000000000000000000000000000000000000000000000", new String(c));
     }
 
+    @Test
     public void testHelloWorldLowerCaseHex() {
         byte[] b = StringUtils.getBytesUtf8("Hello World");
         final String expected = "48656c6c6f20576f726c64";
@@ -333,6 +353,7 @@ public class HexTest extends TestCase {
         assertFalse(expected.equals(new String(actual)));
     }
 
+    @Test
     public void testHelloWorldUpperCaseHex() {
         byte[] b = StringUtils.getBytesUtf8("Hello World");
         final String expected = "48656C6C6F20576F726C64";
@@ -345,6 +366,7 @@ public class HexTest extends TestCase {
         assertTrue(expected.equals(new String(actual)));
     }
 
+    @Test
     public void testRequiredCharset() throws UnsupportedEncodingException, DecoderException {
         testCustomCharset("UTF-8", "testRequiredCharset");
         testCustomCharset("UTF-16", "testRequiredCharset");

Modified: commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/StringUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/StringUtilsTest.java?rev=1087894&r1=1087893&r2=1087894&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/StringUtilsTest.java (original)
+++ commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/StringUtilsTest.java Fri Apr  1 20:59:03 2011
@@ -21,7 +21,8 @@ import java.io.UnsupportedEncodingExcept
 import java.util.Arrays;
 
 import junit.framework.Assert;
-import junit.framework.TestCase;
+
+import org.junit.Test;
 
 /**
  * Tests {@link StringUtils}
@@ -29,7 +30,7 @@ import junit.framework.TestCase;
  * @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
  * @version $Id$
  */
-public class StringUtilsTest extends TestCase {
+public class StringUtilsTest {
 
     private static final byte[] BYTES_FIXTURE = {'a','b','c'};
 
@@ -39,10 +40,12 @@ public class StringUtilsTest extends Tes
      * We could make the constructor private but there does not seem to be a point to jumping through extra code hoops
      * to restrict instantiation right now.
      */
+    @Test
     public void testConstructor() {
         new StringUtils();
     }
 
+    @Test
     public void testGetBytesIso8859_1() throws UnsupportedEncodingException {
         String charsetName = "ISO-8859-1";
         testGetBytesUnchecked(charsetName);
@@ -57,6 +60,7 @@ public class StringUtilsTest extends Tes
         Assert.assertTrue(Arrays.equals(expected, actual));
     }
 
+    @Test
     public void testGetBytesUsAscii() throws UnsupportedEncodingException {
         String charsetName = "US-ASCII";
         testGetBytesUnchecked(charsetName);
@@ -65,6 +69,7 @@ public class StringUtilsTest extends Tes
         Assert.assertTrue(Arrays.equals(expected, actual));
     }
 
+    @Test
     public void testGetBytesUtf16() throws UnsupportedEncodingException {
         String charsetName = "UTF-16";
         testGetBytesUnchecked(charsetName);
@@ -73,6 +78,7 @@ public class StringUtilsTest extends Tes
         Assert.assertTrue(Arrays.equals(expected, actual));
     }
 
+    @Test
     public void testGetBytesUtf16Be() throws UnsupportedEncodingException {
         String charsetName = "UTF-16BE";
         testGetBytesUnchecked(charsetName);
@@ -81,6 +87,7 @@ public class StringUtilsTest extends Tes
         Assert.assertTrue(Arrays.equals(expected, actual));
     }
 
+    @Test
     public void testGetBytesUtf16Le() throws UnsupportedEncodingException {
         String charsetName = "UTF-16LE";
         testGetBytesUnchecked(charsetName);
@@ -89,6 +96,7 @@ public class StringUtilsTest extends Tes
         Assert.assertTrue(Arrays.equals(expected, actual));
     }
 
+    @Test
     public void testGetBytesUtf8() throws UnsupportedEncodingException {
         String charsetName = "UTF-8";
         testGetBytesUnchecked(charsetName);
@@ -97,6 +105,7 @@ public class StringUtilsTest extends Tes
         Assert.assertTrue(Arrays.equals(expected, actual));
     }
 
+    @Test
     public void testGetBytesUncheckedBadName() {
         try {
             StringUtils.getBytesUnchecked(STRING_FIXTURE, "UNKNOWN");
@@ -112,6 +121,7 @@ public class StringUtilsTest extends Tes
         Assert.assertEquals(expected, actual);
     }
 
+    @Test
     public void testNewStringBadEnc() {
         try {
             StringUtils.newString(BYTES_FIXTURE, "UNKNOWN");
@@ -121,6 +131,7 @@ public class StringUtilsTest extends Tes
         }
     }
 
+    @Test
     public void testNewStringIso8859_1() throws UnsupportedEncodingException {
         String charsetName = "ISO-8859-1";
         testNewString(charsetName);
@@ -129,6 +140,7 @@ public class StringUtilsTest extends Tes
         Assert.assertEquals(expected, actual);
     }
 
+    @Test
     public void testNewStringUsAscii() throws UnsupportedEncodingException {
         String charsetName = "US-ASCII";
         testNewString(charsetName);
@@ -137,6 +149,7 @@ public class StringUtilsTest extends Tes
         Assert.assertEquals(expected, actual);
     }
 
+    @Test
     public void testNewStringUtf16() throws UnsupportedEncodingException {
         String charsetName = "UTF-16";
         testNewString(charsetName);
@@ -145,6 +158,7 @@ public class StringUtilsTest extends Tes
         Assert.assertEquals(expected, actual);
     }
 
+    @Test
     public void testNewStringUtf16Be() throws UnsupportedEncodingException {
         String charsetName = "UTF-16BE";
         testNewString(charsetName);
@@ -153,6 +167,7 @@ public class StringUtilsTest extends Tes
         Assert.assertEquals(expected, actual);
     }
 
+    @Test
     public void testNewStringUtf16Le() throws UnsupportedEncodingException {
         String charsetName = "UTF-16LE";
         testNewString(charsetName);
@@ -161,6 +176,7 @@ public class StringUtilsTest extends Tes
         Assert.assertEquals(expected, actual);
     }
 
+    @Test
     public void testNewStringUtf8() throws UnsupportedEncodingException {
         String charsetName = "UTF-8";
         testNewString(charsetName);

Modified: commons/proper/codec/trunk/src/test/org/apache/commons/codec/digest/DigestUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/digest/DigestUtilsTest.java?rev=1087894&r1=1087893&r2=1087894&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/org/apache/commons/codec/digest/DigestUtilsTest.java (original)
+++ commons/proper/codec/trunk/src/test/org/apache/commons/codec/digest/DigestUtilsTest.java Fri Apr  1 20:59:03 2011
@@ -17,13 +17,15 @@
 
 package org.apache.commons.codec.digest;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.util.Random;
 
 import org.apache.commons.codec.binary.StringUtils;
-
-import junit.framework.TestCase;
+import org.junit.Test;
 
 /**
  * Tests DigestUtils methods.
@@ -31,7 +33,7 @@ import junit.framework.TestCase;
  * @author Apache Software Foundation
  * @version $Id$
  */
-public class DigestUtilsTest extends TestCase {
+public class DigestUtilsTest {
 
     private byte[] testData = new byte[1024*1024];
     
@@ -46,10 +48,12 @@ public class DigestUtilsTest extends Tes
         new Random().nextBytes(testData);
     }
 
+    @Test
     public void testConstructable() {
         new DigestUtils();
     }
     
+    @Test
     public void testInternalNoSuchAlgorithmException() {
         try {
             DigestUtils.getDigest("Bogus Bogus");
@@ -59,6 +63,7 @@ public class DigestUtilsTest extends Tes
         }
     }
 
+    @Test
     public void testMd5Hex() throws IOException {
         // Examples from RFC 1321
         assertEquals("d41d8cd98f00b204e9800998ecf8427e", DigestUtils.md5Hex(""));
@@ -86,6 +91,7 @@ public class DigestUtilsTest extends Tes
     /**
      * An MD5 hash converted to hex should always be 32 characters.
      */
+    @Test
     public void testMD5HexLength() {
         String hashMe = "this is some string that is longer than 32 characters";
         String hash = DigestUtils.md5Hex(getBytesUtf8(hashMe));
@@ -99,6 +105,7 @@ public class DigestUtilsTest extends Tes
     /**
      * An MD5 hash should always be a 16 element byte[].
      */
+    @Test
     public void testMD5Length() {
         String hashMe = "this is some string that is longer than 16 characters";
         byte[] hash = DigestUtils.md5(getBytesUtf8(hashMe));
@@ -109,6 +116,7 @@ public class DigestUtilsTest extends Tes
         assertEquals(16, hash.length);
     }
 
+    @Test
     public void testSha256() throws IOException {
     // Examples from FIPS 180-2
     assertEquals("ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad",
@@ -122,6 +130,7 @@ public class DigestUtilsTest extends Tes
             DigestUtils.sha256Hex(new ByteArrayInputStream(testData)));
     }    
 
+    @Test
     public void testSha384() throws IOException {
     // Examples from FIPS 180-2
     assertEquals("cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed" + 
@@ -138,6 +147,7 @@ public class DigestUtilsTest extends Tes
             DigestUtils.sha384Hex(new ByteArrayInputStream(testData)));
     }
 
+    @Test
     public void testSha512() throws IOException {
     // Examples from FIPS 180-2
     assertEquals("ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a" +
@@ -154,6 +164,7 @@ public class DigestUtilsTest extends Tes
             DigestUtils.sha512Hex(new ByteArrayInputStream(testData)));
 }    
 
+    @Test
     public void testShaHex() throws IOException {
         // Examples from FIPS 180-1
         assertEquals("a9993e364706816aba3e25717850c26c9cd0d89d", DigestUtils.shaHex("abc"));

Modified: commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/Caverphone1Test.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/Caverphone1Test.java?rev=1087894&r1=1087893&r2=1087894&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/Caverphone1Test.java (original)
+++ commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/Caverphone1Test.java Fri Apr  1 20:59:03 2011
@@ -22,6 +22,7 @@ import junit.framework.Assert;
 import org.apache.commons.codec.EncoderException;
 import org.apache.commons.codec.StringEncoder;
 import org.apache.commons.codec.StringEncoderAbstractTest;
+import org.junit.Test;
 
 /**
  * Tests Caverphone1.
@@ -32,10 +33,6 @@ import org.apache.commons.codec.StringEn
  */
 public class Caverphone1Test extends StringEncoderAbstractTest {
 
-    public Caverphone1Test(String name) {
-        super(name);
-    }
-
     protected StringEncoder createStringEncoder() {
         return new Caverphone1();
     }
@@ -47,6 +44,7 @@ public class Caverphone1Test extends Str
      * 
      * @throws EncoderException
      */
+    @Test
     public void testCaverphoneRevisitedCommonCodeAT1111() throws EncoderException {
         this.checkEncodingVariations("AT1111", new String[]{
             "add",
@@ -66,6 +64,7 @@ public class Caverphone1Test extends Str
             "old"});
     }
 
+    @Test
     public void testEndMb() throws EncoderException {
         String[][] data = {{"mb", "M11111"}, {"mbmb", "MPM111"}};
         this.checkEncodings(data);
@@ -76,6 +75,7 @@ public class Caverphone1Test extends Str
      * 
      * @throws EncoderException
      */
+    @Test
     public void testIsCaverphoneEquals() throws EncoderException {
         Caverphone1 caverphone = new Caverphone1();
         Assert.assertFalse("Caverphone encodings should not be equal", caverphone.isEncodeEqual("Peter", "Stevenson"));
@@ -87,6 +87,7 @@ public class Caverphone1Test extends Str
      * 
      * @throws EncoderException
      */
+    @Test
     public void testSpecificationV1Examples() throws EncoderException {
         String[][] data = {{"David", "TFT111"}, {"Whittle", "WTL111"}};
         this.checkEncodings(data);
@@ -97,6 +98,7 @@ public class Caverphone1Test extends Str
      * 
      * @throws EncoderException
      */
+    @Test
     public void testWikipediaExamples() throws EncoderException {
         String[][] data = {{"Lee", "L11111"}, {"Thompson", "TMPSN1"}};
         this.checkEncodings(data);



Mime
View raw message