commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1442904 - in /commons/proper/cli/trunk: ./ src/test/java/org/apache/commons/cli/ src/test/java/org/apache/commons/cli/bug/
Date Wed, 06 Feb 2013 10:57:45 GMT
Author: tn
Date: Wed Feb  6 10:57:45 2013
New Revision: 1442904

URL: http://svn.apache.org/viewvc?rev=1442904&view=rev
Log:
[CLI-227] Convert unit tests to junit 4, upgrade junit to 4.11, move authors to pom.xml.

Modified:
    commons/proper/cli/trunk/pom.xml
    commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ApplicationTest.java
    commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ArgumentIsOptionTest.java
    commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/BasicParserTest.java
    commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/BugsTest.java
    commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/CommandLineTest.java
    commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/DefaultParserTest.java
    commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/GnuParserTest.java
    commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/HelpFormatterTest.java
    commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionBuilderTest.java
    commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionGroupTest.java
    commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionTest.java
    commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionsTest.java
    commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ParserTestCase.java
    commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/PatternOptionBuilderTest.java
    commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/PosixParserTest.java
    commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/UtilTest.java
    commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ValueTest.java
    commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ValuesTest.java
    commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI133Test.java
    commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI13Test.java
    commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI148Test.java
    commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI162Test.java
    commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI18Test.java
    commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI71Test.java

Modified: commons/proper/cli/trunk/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/pom.xml?rev=1442904&r1=1442903&r2=1442904&view=diff
==============================================================================
--- commons/proper/cli/trunk/pom.xml (original)
+++ commons/proper/cli/trunk/pom.xml Wed Feb  6 10:57:45 2013
@@ -121,6 +121,12 @@
         <role>lots of fixes for 1.1</role>
       </roles>
     </contributor>
+    <contributor>
+      <name>Slawek Zachcial</name>
+      <roles>
+        <role>unit tests</role>
+      </roles>
+    </contributor>
     
   </contributors>
 
@@ -129,7 +135,7 @@
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
-      <version>4.8.2</version>
+      <version>4.11</version>
       <scope>test</scope>
     </dependency>
     <dependency>

Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ApplicationTest.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ApplicationTest.java?rev=1442904&r1=1442903&r2=1442904&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ApplicationTest.java (original)
+++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ApplicationTest.java Wed Feb  6 10:57:45 2013
@@ -17,7 +17,10 @@
 
 package org.apache.commons.cli;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
 
 /**
  * This is a collection of tests that test real world applications command lines.
@@ -31,12 +34,11 @@ import junit.framework.TestCase;
  *   <li>man</li>
  * </ul>
  * </p>
- *
- * @author John Keyes (john at integralsource.com)
  */
 @SuppressWarnings("deprecation") // tests some deprecated classes
-public class ApplicationTest extends TestCase {
-
+public class ApplicationTest
+{
+    @Test
     public void testLs() throws Exception {
         // create the command line parser
         CommandLineParser parser = new PosixParser();
@@ -63,6 +65,7 @@ public class ApplicationTest extends Tes
     /**
      * Ant test
      */
+    @Test
     public void testAnt() throws Exception {
         // use the GNU parser
         CommandLineParser parser = new GnuParser( );
@@ -104,6 +107,7 @@ public class ApplicationTest extends Tes
         assertTrue( line.hasOption( "projecthelp") );
     }
 
+    @Test
     public void testGroovy() throws Exception {
         Options options = new Options();
 
@@ -174,6 +178,7 @@ public class ApplicationTest extends Tes
     /**
      * author Slawek Zachcial
      */
+    @Test
     public void testMan()
     {
         String cmdLine =
@@ -223,6 +228,7 @@ public class ApplicationTest extends Tes
     /**
      * Real world test with long and short options.
      */
+    @Test
     public void testNLT() throws Exception {
         Option help = new Option("h", "help", false, "print this message");
         Option version = new Option("v", "version", false, "print version information");

Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ArgumentIsOptionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ArgumentIsOptionTest.java?rev=1442904&r1=1442903&r2=1442904&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ArgumentIsOptionTest.java (original)
+++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ArgumentIsOptionTest.java Wed Feb  6 10:57:45 2013
@@ -17,15 +17,19 @@
 
 package org.apache.commons.cli;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Before;
+import org.junit.Test;
 
 @SuppressWarnings("deprecation") // tests some deprecated classes
-public class ArgumentIsOptionTest extends TestCase
+public class ArgumentIsOptionTest
 {
     private Options options = null;
     private CommandLineParser parser = null;
 
-    @Override
+    @Before
     public void setUp()
     {
         options = new Options().addOption("p", false, "Option p").addOption("attr", true, "Option accepts argument");
@@ -33,6 +37,7 @@ public class ArgumentIsOptionTest extend
         parser = new PosixParser();
     }
 
+    @Test
     public void testOptionAndOptionWithArgument() throws Exception
     {
         String[] args = new String[]{
@@ -48,6 +53,7 @@ public class ArgumentIsOptionTest extend
         assertTrue("Confirm all arguments recognized", cl.getArgs().length == 0);
     }
 
+    @Test
     public void testOptionWithArgument() throws Exception
     {
         String[] args = new String[]{
@@ -63,6 +69,7 @@ public class ArgumentIsOptionTest extend
         assertTrue("Confirm all arguments recognized", cl.getArgs().length == 0);
     }
 
+    @Test
     public void testOption() throws Exception
     {
         String[] args = new String[]{

Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/BasicParserTest.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/BasicParserTest.java?rev=1442904&r1=1442903&r2=1442904&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/BasicParserTest.java (original)
+++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/BasicParserTest.java Wed Feb  6 10:57:45 2013
@@ -17,14 +17,12 @@
 
 package org.apache.commons.cli;
 
-/**
- * @author Emmanuel Bourg
- * @version $Revision$, $Date$
- */
+import org.junit.Before;
+
 @SuppressWarnings("deprecation") // tests some deprecated classes
 public class BasicParserTest extends ParserTestCase
 {
-    @Override
+    @Before
     public void setUp()
     {
         super.setUp();

Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/BugsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/BugsTest.java?rev=1442904&r1=1442903&r2=1442904&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/BugsTest.java (original)
+++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/BugsTest.java Wed Feb  6 10:57:45 2013
@@ -17,16 +17,22 @@
 
 package org.apache.commons.cli;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.io.ByteArrayOutputStream;
 import java.io.PrintStream;
 import java.util.Iterator;
 import java.util.Properties;
 
-import junit.framework.TestCase;
+import org.junit.Test;
 
 @SuppressWarnings("deprecation") // tests some deprecated classes
-public class BugsTest extends TestCase
+public class BugsTest
 {
+    @Test
     public void test11457() throws Exception
     {
         Options options = new Options();
@@ -39,6 +45,7 @@ public class BugsTest extends TestCase
         assertTrue(cmd.hasOption("verbose"));
     }
 
+    @Test
     public void test11458() throws Exception
     {
         Options options = new Options();
@@ -82,6 +89,7 @@ public class BugsTest extends TestCase
         }
     }
 
+    @Test
     public void test11680() throws Exception
     {
         Options options = new Options();
@@ -97,6 +105,7 @@ public class BugsTest extends TestCase
         cmd.getOptionValue("m", "default m");
     }
 
+    @Test
     public void test11456() throws Exception
     {
         // Posix 
@@ -122,6 +131,7 @@ public class BugsTest extends TestCase
         assertEquals( cmd.getOptionValue( 'b' ), "value" );
     }
 
+    @Test
     public void test12210() throws Exception
     {
         // create the main options object which will handle the first parameter
@@ -178,6 +188,7 @@ public class BugsTest extends TestCase
         }
     }
 
+    @Test
     public void test13425() throws Exception
     {
         Options options = new Options();
@@ -208,6 +219,7 @@ public class BugsTest extends TestCase
         }
     }
 
+    @Test
     public void test13666() throws Exception
     {
         Options options = new Options();
@@ -238,6 +250,7 @@ public class BugsTest extends TestCase
         }
     }
 
+    @Test
     public void test13935() throws Exception
     {
         OptionGroup directions = new OptionGroup();
@@ -284,6 +297,7 @@ public class BugsTest extends TestCase
         assertNotNull(line);
     }
 
+    @Test
     public void test14786() throws Exception
     {
         Option o = OptionBuilder.isRequired().withDescription("test").create("test");
@@ -299,6 +313,7 @@ public class BugsTest extends TestCase
         assertTrue( line.hasOption( "test" ) );
     }
 
+    @Test
     public void test15046() throws Exception
     {
         CommandLineParser parser = new PosixParser();
@@ -316,6 +331,7 @@ public class BugsTest extends TestCase
         assertTrue( !line.hasOption("c") );
     }
 
+    @Test
     public void test15648() throws Exception
     {
         CommandLineParser parser = new PosixParser();
@@ -327,6 +343,7 @@ public class BugsTest extends TestCase
         assertEquals( "Two Words", line.getOptionValue( "m" ) );
     }
     
+    @Test
     public void test31148() throws ParseException
     {
         Option multiArgOption = new Option("o","option with multiple args");

Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/CommandLineTest.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/CommandLineTest.java?rev=1442904&r1=1442903&r2=1442904&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/CommandLineTest.java (original)
+++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/CommandLineTest.java Wed Feb  6 10:57:45 2013
@@ -17,17 +17,17 @@
 
 package org.apache.commons.cli;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
 import java.util.Properties;
 
-import junit.framework.TestCase;
+import org.junit.Test;
 
-/**
- * @author Emmanuel Bourg
- * @version $Revision$, $Date$
- */
 @SuppressWarnings("deprecation") // tests some deprecated classes
-public class CommandLineTest extends TestCase
+public class CommandLineTest
 {
+    @Test
     public void testGetOptionProperties() throws Exception
     {
         String[] args = new String[] { "-Dparam1=value1", "-Dparam2=value2", "-Dparam3", "-Dparam4=value4", "-D", "--property", "foo=bar" };
@@ -50,6 +50,7 @@ public class CommandLineTest extends Tes
         assertEquals("property with long format", "bar", cl.getOptionProperties("property").getProperty("foo"));
     }
 
+    @Test
     public void testGetOptions()
     {
         CommandLine cmd = new CommandLine();
@@ -63,6 +64,7 @@ public class CommandLineTest extends Tes
         assertEquals(3, cmd.getOptions().length);
     }
 
+    @Test
     public void testGetParsedOptionValue() throws Exception {
         Options options = new Options();
         options.addOption(OptionBuilder.hasArg().withType(Number.class).create("i"));

Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/DefaultParserTest.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/DefaultParserTest.java?rev=1442904&r1=1442903&r2=1442904&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/DefaultParserTest.java (original)
+++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/DefaultParserTest.java Wed Feb  6 10:57:45 2013
@@ -17,13 +17,11 @@
 
 package org.apache.commons.cli;
 
-/**
- * @author Emmanuel Bourg
- * @version $Revision$, $Date$
- */
+import org.junit.Before;
+
 public class DefaultParserTest extends ParserTestCase {
 
-    @Override
+    @Before
     public void setUp() {
         super.setUp();
         parser = new DefaultParser();

Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/GnuParserTest.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/GnuParserTest.java?rev=1442904&r1=1442903&r2=1442904&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/GnuParserTest.java (original)
+++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/GnuParserTest.java Wed Feb  6 10:57:45 2013
@@ -17,10 +17,12 @@
 
 package org.apache.commons.cli;
 
+import org.junit.Before;
+
 @SuppressWarnings("deprecation") // tests some deprecated classes
 public class GnuParserTest extends ParserTestCase
 {
-    @Override
+    @Before
     public void setUp()
     {
         super.setUp();
@@ -105,8 +107,8 @@ public class GnuParserTest extends Parse
         // not supported by the GnuParser
     }
 
-   @Override
-public void testAmbiguousPartialLongOption3() throws Exception
+    @Override
+    public void testAmbiguousPartialLongOption3() throws Exception
     {
         // not supported by the GnuParser
     }

Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/HelpFormatterTest.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/HelpFormatterTest.java?rev=1442904&r1=1442903&r2=1442904&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/HelpFormatterTest.java (original)
+++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/HelpFormatterTest.java Wed Feb  6 10:57:45 2013
@@ -17,24 +17,24 @@
 
 package org.apache.commons.cli;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
 import java.io.ByteArrayOutputStream;
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.util.Comparator;
 
-import junit.framework.TestCase;
+import org.junit.Test;
 
 /** 
- * Test case for the HelpFormatter class 
- *
- * @author Slawek Zachcial
- * @author John Keyes ( john at integralsource.com )
- * @author brianegge
+ * Test case for the HelpFormatter class.
  */
-public class HelpFormatterTest extends TestCase
+public class HelpFormatterTest
 {
     private static final String EOL = System.getProperty("line.separator");
 
+    @Test
     public void testFindWrapPos() throws Exception
     {
         HelpFormatter hf = new HelpFormatter();
@@ -62,6 +62,7 @@ public class HelpFormatterTest extends T
         assertEquals("wrap position 6", 7, hf.findWrapPos(text, 6, 0));
     }
 
+    @Test
     public void testRenderWrappedTextWordCut()
     {
         int width = 7;
@@ -75,6 +76,7 @@ public class HelpFormatterTest extends T
         assertEquals("cut and wrap", expected, sb.toString());
     }
 
+    @Test
     public void testRenderWrappedTextSingleLine()
     {
         // single line text
@@ -89,6 +91,7 @@ public class HelpFormatterTest extends T
         assertEquals("single line text", expected, sb.toString());
     }
 
+    @Test
     public void testRenderWrappedTextSingleLinePadded()
     {
         // single line padded text
@@ -103,6 +106,7 @@ public class HelpFormatterTest extends T
         assertEquals("single line padded text", expected, sb.toString());
     }
 
+    @Test
     public void testRenderWrappedTextSingleLinePadded2()
     {
         // single line padded text 2
@@ -119,6 +123,7 @@ public class HelpFormatterTest extends T
         assertEquals("single line padded text 2", expected, sb.toString());
     }
 
+    @Test
     public void testRenderWrappedTextMultiLine()
     {
         // multi line text
@@ -134,6 +139,7 @@ public class HelpFormatterTest extends T
         assertEquals("multi line text", expected, sb.toString());
     }
 
+    @Test
     public void testRenderWrappedTextMultiLinePadded()
     {
         // multi-line padded text
@@ -151,6 +157,7 @@ public class HelpFormatterTest extends T
         assertEquals("multi-line padded text", expected, sb.toString());
     }
 
+    @Test
     public void testPrintOptions() throws Exception
     {
         StringBuffer sb = new StringBuffer();
@@ -200,6 +207,7 @@ public class HelpFormatterTest extends T
         assertEquals("multiple wrapped options", expected, sb.toString());
     }
 
+    @Test
     public void testPrintHelpWithEmptySyntax()
     {
         HelpFormatter formatter = new HelpFormatter();
@@ -224,6 +232,7 @@ public class HelpFormatterTest extends T
         }
     }
 
+    @Test
     public void testAutomaticUsage() throws Exception
     {
         HelpFormatter hf = new HelpFormatter();
@@ -249,6 +258,7 @@ public class HelpFormatterTest extends T
 
     // This test ensures the options are properly sorted
     // See https://issues.apache.org/jira/browse/CLI-131
+    @Test
     public void testPrintUsage()
     {
         Option optionA = new Option("a", "first");
@@ -267,6 +277,7 @@ public class HelpFormatterTest extends T
     }
 
     // uses the test for CLI-131 to implement CLI-155
+    @Test
     public void testPrintSortedUsage()
     {
         Options opts = new Options();
@@ -279,7 +290,7 @@ public class HelpFormatterTest extends T
         {
             public int compare(Option opt1, Option opt2)
             {
-                // reverses the fuctionality of the default comparator
+                // reverses the functionality of the default comparator
                 return opt2.getKey().compareToIgnoreCase(opt1.getKey());
             }
         });
@@ -290,6 +301,7 @@ public class HelpFormatterTest extends T
         assertEquals("usage: app [-c] [-b] [-a]" + EOL, out.toString());
     }
 
+    @Test
     public void testPrintSortedUsageWithNullComparator()
     {
         Options opts = new Options();
@@ -306,6 +318,7 @@ public class HelpFormatterTest extends T
         assertEquals("usage: app [-c] [-b] [-a]" + EOL, out.toString());
     }
 
+    @Test
     public void testPrintOptionGroupUsage()
     {
         OptionGroup group = new OptionGroup();
@@ -324,6 +337,7 @@ public class HelpFormatterTest extends T
         assertEquals("usage: app [-a | -b | -c]" + EOL, out.toString());
     }
 
+    @Test
     public void testPrintRequiredOptionGroupUsage()
     {
         OptionGroup group = new OptionGroup();
@@ -343,6 +357,7 @@ public class HelpFormatterTest extends T
         assertEquals("usage: app -a | -b | -c" + EOL, out.toString());
     }
 
+    @Test
     public void testPrintOptionWithEmptyArgNameUsage()
     {
         Option option = new Option("f", true, null);
@@ -360,6 +375,7 @@ public class HelpFormatterTest extends T
         assertEquals("usage: app -f" + EOL, out.toString());
     }
 
+    @Test
     public void testDefaultArgName()
     {
         Option option = OptionBuilder.hasArg().isRequired().create("f");
@@ -376,6 +392,7 @@ public class HelpFormatterTest extends T
         assertEquals("usage: app -f <argument>" + EOL, out.toString());
     }
 
+    @Test
     public void testRtrim()
     {
         HelpFormatter formatter = new HelpFormatter();
@@ -385,6 +402,7 @@ public class HelpFormatterTest extends T
         assertEquals("  foo", formatter.rtrim("  foo  "));
     }
 
+    @Test
     public void testAccessors()
     {
         HelpFormatter formatter = new HelpFormatter();
@@ -414,6 +432,7 @@ public class HelpFormatterTest extends T
         assertEquals("width", 80, formatter.getWidth());
     }
     
+    @Test
     public void testHeaderStartingWithLineSeparator()
     {
         // related to Bugzilla #21215
@@ -432,6 +451,7 @@ public class HelpFormatterTest extends T
                 , out.toString());
     }
 
+    @Test
     public void testIndentedHeaderAndFooter()
     {
         // related to CLI-207
@@ -452,6 +472,7 @@ public class HelpFormatterTest extends T
                 , out.toString());
     }
 
+    @Test
     public void testOptionWithoutShortFormat()
     {
         // related to Bugzilla #19383 (CLI-67)
@@ -471,7 +492,7 @@ public class HelpFormatterTest extends T
                 , out.toString());
     }
     
-
+    @Test
     public void testOptionWithoutShortFormat2()
     {
         // related to Bugzilla #27635 (CLI-26)
@@ -542,6 +563,7 @@ public class HelpFormatterTest extends T
                 ,out.toString());
     }
     
+    @Test
     public void testHelpWithLongOptSeparator() throws Exception
     {
         Options options = new Options();
@@ -568,6 +590,7 @@ public class HelpFormatterTest extends T
                 out.toString());
     }
 
+    @Test
     public void testUsageWithLongOptSeparator() throws Exception
     {
         Options options = new Options();

Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionBuilderTest.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionBuilderTest.java?rev=1442904&r1=1442903&r2=1442904&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionBuilderTest.java (original)
+++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionBuilderTest.java Wed Feb  6 10:57:45 2013
@@ -17,10 +17,16 @@
 
 package org.apache.commons.cli;
 
-import junit.framework.TestCase;
-
-public class OptionBuilderTest extends TestCase {
-
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.junit.Test;
+
+public class OptionBuilderTest
+{
+    @Test
     public void testCompleteOption( ) {
         Option simple = OptionBuilder.withLongOpt( "simple option")
                                      .hasArg( )
@@ -39,6 +45,7 @@ public class OptionBuilderTest extends T
         assertTrue( simple.hasArgs() );
     }
 
+    @Test
     public void testTwoCompleteOptions( ) {
         Option simple = OptionBuilder.withLongOpt( "simple option")
                                      .hasArg( )
@@ -70,6 +77,7 @@ public class OptionBuilderTest extends T
         assertTrue( !simple.hasArgs() );
     }
 
+    @Test
     public void testBaseOptionCharOpt() {
         Option base = OptionBuilder.withDescription( "option description")
                                    .create( 'o' );
@@ -79,6 +87,7 @@ public class OptionBuilderTest extends T
         assertTrue( !base.hasArg() );
     }
 
+    @Test
     public void testBaseOptionStringOpt() {
         Option base = OptionBuilder.withDescription( "option description")
                                    .create( "o" );
@@ -88,6 +97,7 @@ public class OptionBuilderTest extends T
         assertTrue( !base.hasArg() );
     }
 
+    @Test
     public void testSpecialOptChars() throws Exception
     {
         // '?'
@@ -107,6 +117,7 @@ public class OptionBuilderTest extends T
         }
     }
 
+    @Test
     public void testOptionArgNumbers()
     {
         Option opt = OptionBuilder.withDescription( "option description" )
@@ -115,6 +126,7 @@ public class OptionBuilderTest extends T
         assertEquals( 2, opt.getArgs() );
     }
 
+    @Test
     public void testIllegalOptions() {
         // bad single character option
         try {
@@ -144,6 +156,7 @@ public class OptionBuilderTest extends T
         }
     }
 
+    @Test
     public void testCreateIncompleteOption() {
         try
         {
@@ -159,6 +172,7 @@ public class OptionBuilderTest extends T
         }
     }
 
+    @Test
     public void testBuilderIsResettedAlways() {
         try
         {

Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionGroupTest.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionGroupTest.java?rev=1442904&r1=1442903&r2=1442904&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionGroupTest.java (original)
+++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionGroupTest.java Wed Feb  6 10:57:45 2013
@@ -17,21 +17,23 @@
 
 package org.apache.commons.cli;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.util.Properties;
 
-import junit.framework.TestCase;
+import org.junit.Before;
+import org.junit.Test;
 
-/**
- * @author John Keyes (john at integralsource.com)
- * @version $Revision$
- */
 @SuppressWarnings("deprecation") // tests some deprecated classes
-public class OptionGroupTest extends TestCase
+public class OptionGroupTest
 {
     private Options _options = null;
     private Parser parser = new PosixParser();
 
-    @Override
+    @Before
     public void setUp()
     {
         Option file = new Option( "f", "file", false, "file to process" );
@@ -59,6 +61,7 @@ public class OptionGroupTest extends Tes
         _options.addOption( "r", "revision", false, "revision number" );
     }
 
+    @Test
     public void testSingleOptionFromGroup() throws Exception
     {
         String[] args = new String[] { "-f" };
@@ -73,6 +76,7 @@ public class OptionGroupTest extends Tes
         assertTrue( "Confirm no extra args", cl.getArgList().size() == 0);
     }
 
+    @Test
     public void testSingleOption() throws Exception
     {
         String[] args = new String[] { "-r" };
@@ -87,6 +91,7 @@ public class OptionGroupTest extends Tes
         assertTrue( "Confirm no extra args", cl.getArgList().size() == 0);
     }
 
+    @Test
     public void testTwoValidOptions() throws Exception
     {
         String[] args = new String[] { "-r", "-f" };
@@ -101,6 +106,7 @@ public class OptionGroupTest extends Tes
         assertTrue( "Confirm no extra args", cl.getArgList().size() == 0);
     }
 
+    @Test
     public void testSingleLongOption() throws Exception
     {
         String[] args = new String[] { "--file" };
@@ -115,6 +121,7 @@ public class OptionGroupTest extends Tes
         assertTrue( "Confirm no extra args", cl.getArgList().size() == 0);
     }
 
+    @Test
     public void testTwoValidLongOptions() throws Exception
     {
         String[] args = new String[] { "--revision", "--file" };
@@ -129,6 +136,7 @@ public class OptionGroupTest extends Tes
         assertTrue( "Confirm no extra args", cl.getArgList().size() == 0);
     }
 
+    @Test
     public void testNoOptionsExtraArgs() throws Exception
     {
         String[] args = new String[] { "arg1", "arg2" };
@@ -143,6 +151,7 @@ public class OptionGroupTest extends Tes
         assertTrue( "Confirm TWO extra args", cl.getArgList().size() == 2);
     }
 
+    @Test
     public void testTwoOptionsFromGroup() throws Exception
     {
         String[] args = new String[] { "-f", "-d" };
@@ -160,6 +169,7 @@ public class OptionGroupTest extends Tes
         }
     }
 
+    @Test
     public void testTwoLongOptionsFromGroup() throws Exception
     {
         String[] args = new String[] { "--file", "--directory" };
@@ -177,6 +187,7 @@ public class OptionGroupTest extends Tes
         }
     }
 
+    @Test
     public void testTwoOptionsFromDifferentGroup() throws Exception
     {
         String[] args = new String[] { "-f", "-s" };
@@ -190,6 +201,7 @@ public class OptionGroupTest extends Tes
         assertTrue( "Confirm NO extra args", cl.getArgList().size() == 0);
     }
 
+    @Test
     public void testTwoOptionsFromGroupWithProperties() throws Exception
     {
         String[] args = new String[] { "-f" };
@@ -202,6 +214,7 @@ public class OptionGroupTest extends Tes
         assertTrue(!cl.hasOption("d"));
     }
 
+    @Test
     public void testValidLongOnlyOptions() throws Exception
     {
         CommandLine cl1 = parser.parse(_options, new String[]{"--export"});
@@ -211,6 +224,7 @@ public class OptionGroupTest extends Tes
         assertTrue("Confirm --import is set", cl2.hasOption("import"));
     }
 
+    @Test
     public void testToString()
     {
         OptionGroup group1 = new OptionGroup();
@@ -230,6 +244,7 @@ public class OptionGroupTest extends Tes
         }
     }
 
+    @Test
     public void testGetNames()
     {
         OptionGroup group = new OptionGroup();

Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionTest.java?rev=1442904&r1=1442903&r2=1442904&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionTest.java (original)
+++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionTest.java Wed Feb  6 10:57:45 2013
@@ -17,12 +17,14 @@
 
 package org.apache.commons.cli;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertTrue;
 
-/**
- * @author brianegge
- */
-public class OptionTest extends TestCase
+import org.junit.Test;
+
+public class OptionTest
 {
     private static class TestOption extends Option
     {
@@ -39,6 +41,7 @@ public class OptionTest extends TestCase
         }
     }
 
+    @Test
     public void testClear()
     {
         TestOption option = new TestOption("x", true, "");
@@ -50,6 +53,7 @@ public class OptionTest extends TestCase
     }
 
     // See http://issues.apache.org/jira/browse/CLI-21
+    @Test
     public void testClone()
     {
         TestOption a = new TestOption("a", true, "");
@@ -83,6 +87,7 @@ public class OptionTest extends TestCase
         }
     }
 
+    @Test
     public void testSubclass()
     {
         Option option = new DefaultOption("f", "file", "myfile.txt");
@@ -91,6 +96,7 @@ public class OptionTest extends TestCase
         assertEquals(DefaultOption.class, clone.getClass());
     }
 
+    @Test
     public void testHasArgName()
     {
         Option option = new Option("f", null);
@@ -105,6 +111,7 @@ public class OptionTest extends TestCase
         assertTrue(option.hasArgName());
     }
 
+    @Test
     public void testHasArgs()
     {
         Option option = new Option("f", null);
@@ -125,6 +132,7 @@ public class OptionTest extends TestCase
         assertFalse(option.hasArgs());
     }
 
+    @Test
     public void testGetValue()
     {
         Option option = new Option("f", null);

Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionsTest.java?rev=1442904&r1=1442903&r2=1442904&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionsTest.java (original)
+++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionsTest.java Wed Feb  6 10:57:45 2013
@@ -17,18 +17,20 @@
 
 package org.apache.commons.cli;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.util.ArrayList;
 import java.util.Collection;
 
-import junit.framework.TestCase;
+import org.junit.Test;
 
-/**
- * @author Rob Oxspring roxspring@apache.org
- * @version $Revision$
- */
 @SuppressWarnings("deprecation") // tests some deprecated classes
-public class OptionsTest extends TestCase
+public class OptionsTest
 {
+    @Test
     public void testSimple()
     {
         Options opts = new Options();
@@ -40,6 +42,7 @@ public class OptionsTest extends TestCas
         assertTrue(opts.hasOption("b"));
     }
 
+    @Test
     public void testDuplicateSimple()
     {
         Options opts = new Options();
@@ -49,6 +52,7 @@ public class OptionsTest extends TestCas
         assertEquals("last one in wins", "toggle -a*", opts.getOption("a").getDescription());
     }
 
+    @Test
     public void testLong()
     {
         Options opts = new Options();
@@ -60,6 +64,7 @@ public class OptionsTest extends TestCas
         assertTrue(opts.hasOption("b"));
     }
 
+    @Test
     public void testDuplicateLong()
     {
         Options opts = new Options();
@@ -68,6 +73,7 @@ public class OptionsTest extends TestCas
         assertEquals("last one in wins", "toggle -a*", opts.getOption("a").getDescription());
     }
 
+    @Test
     public void testHelpOptions()
     {
         Option longOnly1 = OptionBuilder.withLongOpt("long-only1").create();
@@ -99,6 +105,7 @@ public class OptionsTest extends TestCas
         assertTrue("Everything in help should be in all", allOptions.containsAll(helpOptions));        
     }
 
+    @Test
     public void testMissingOptionException() throws ParseException
     {
         Options options = new Options();
@@ -114,6 +121,7 @@ public class OptionsTest extends TestCas
         }
     }
 
+    @Test
     public void testMissingOptionsException() throws ParseException
     {
         Options options = new Options();
@@ -130,6 +138,7 @@ public class OptionsTest extends TestCas
         }
     }
 
+    @Test
     public void testToString()
     {
         Options options = new Options();
@@ -142,6 +151,7 @@ public class OptionsTest extends TestCas
         assertTrue("bar option missing", s.toLowerCase().indexOf("bar") != -1);
     }
 
+    @Test
     public void testGetOptionsGroups()
     {
         Options options = new Options();
@@ -161,6 +171,7 @@ public class OptionsTest extends TestCas
         assertEquals(2, options.getOptionGroups().size());
     }
     
+    @Test
     public void testGetMatchingOpts()
     {
         Options options = new Options();

Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ParserTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ParserTestCase.java?rev=1442904&r1=1442903&r2=1442904&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ParserTestCase.java (original)
+++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ParserTestCase.java Wed Feb  6 10:57:45 2013
@@ -17,25 +17,29 @@
 
 package org.apache.commons.cli;
 
+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.util.Arrays;
 import java.util.List;
 import java.util.Properties;
 
-import junit.framework.TestCase;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * Abstract test case testing common parser features.
- *
- * @author Emmanuel Bourg
- * @version $Revision$, $Date$
  */
-public abstract class ParserTestCase extends TestCase
+public abstract class ParserTestCase
 {
     protected CommandLineParser parser;
 
     protected Options options;
 
-    @Override
+    @Before
     public void setUp()
     {
         options = new Options()
@@ -44,6 +48,7 @@ public abstract class ParserTestCase ext
             .addOption("c", "copt", false, "turn [c] on or off");
     }
 
+    @Test
     public void testSimpleShort() throws Exception
     {
         String[] args = new String[] { "-a",
@@ -58,6 +63,7 @@ public abstract class ParserTestCase ext
         assertTrue("Confirm size of extra args", cl.getArgList().size() == 2);
     }
 
+    @Test
     public void testSimpleLong() throws Exception
     {
         String[] args = new String[] { "--enable-a",
@@ -73,6 +79,7 @@ public abstract class ParserTestCase ext
         assertTrue( "Confirm size of extra args", cl.getArgList().size() == 2);
     }
 
+    @Test
     public void testMultiple() throws Exception
     {
         String[] args = new String[] { "-c",
@@ -92,6 +99,7 @@ public abstract class ParserTestCase ext
         assertTrue("Confirm  value of extra arg: " + cl.getArgList().get(0), cl.getArgList().get(0).equals("foobar"));
     }
 
+    @Test
     public void testMultipleWithLong() throws Exception
     {
         String[] args = new String[] { "--copt",
@@ -111,6 +119,7 @@ public abstract class ParserTestCase ext
         assertTrue("Confirm  value of extra arg: " + cl.getArgList().get(0), cl.getArgList().get(0).equals("foobar"));
     }
 
+    @Test
     public void testUnrecognizedOption() throws Exception
     {
         String[] args = new String[] { "-a", "-d", "-b", "toast", "foo", "bar" };
@@ -126,6 +135,7 @@ public abstract class ParserTestCase ext
         }
     }
 
+    @Test
     public void testMissingArg() throws Exception
     {
         String[] args = new String[] { "-b" };
@@ -145,6 +155,7 @@ public abstract class ParserTestCase ext
         assertTrue( "Confirm MissingArgumentException caught", caught );
     }
 
+    @Test
     public void testDoubleDash1() throws Exception
     {
         String[] args = new String[] { "--copt",
@@ -158,6 +169,7 @@ public abstract class ParserTestCase ext
         assertTrue("Confirm 2 extra args: " + cl.getArgList().size(), cl.getArgList().size() == 2);
     }
 
+    @Test
     public void testDoubleDash2() throws Exception
     {
         Options options = new Options();
@@ -176,6 +188,7 @@ public abstract class ParserTestCase ext
         }
     }
     
+    @Test
     public void testSingleDash() throws Exception
     {
         String[] args = new String[] { "--copt",
@@ -192,6 +205,7 @@ public abstract class ParserTestCase ext
         assertTrue("Confirm value of extra arg: " + cl.getArgList().get(0), cl.getArgList().get(0).equals("-"));
     }
 
+    @Test
     public void testStopAtUnexpectedArg() throws Exception
     {
         String[] args = new String[] { "-c",
@@ -204,7 +218,8 @@ public abstract class ParserTestCase ext
         assertTrue("Confirm  3 extra args: " + cl.getArgList().size(), cl.getArgList().size() == 3);
     }
 
-   public void testStopAtExpectedArg() throws Exception
+    @Test
+    public void testStopAtExpectedArg() throws Exception
     {
         String[] args = new String[]{"-b", "foo"};
 
@@ -215,6 +230,7 @@ public abstract class ParserTestCase ext
         assertTrue("Confirm no extra args: " + cl.getArgList().size(), cl.getArgList().size() == 0);
     }
 
+    @Test
     public void testStopAtNonOptionShort() throws Exception
     {
         String[] args = new String[]{"-z",
@@ -226,6 +242,7 @@ public abstract class ParserTestCase ext
         assertTrue("Confirm  3 extra args: " + cl.getArgList().size(), cl.getArgList().size() == 3);
     }
 
+    @Test
     public void testStopAtNonOptionLong() throws Exception
     {
         String[] args = new String[]{"--zop==1",
@@ -239,6 +256,7 @@ public abstract class ParserTestCase ext
         assertTrue("Confirm  3 extra args: " + cl.getArgList().size(), cl.getArgList().size() == 3);
     }
 
+    @Test
     public void testNegativeArgument() throws Exception
     {
         String[] args = new String[] { "-b", "-1"} ;
@@ -247,6 +265,7 @@ public abstract class ParserTestCase ext
         assertEquals("-1", cl.getOptionValue("b"));
     }
 
+    @Test
     public void testNegativeOption() throws Exception
     {
         String[] args = new String[] { "-b", "-1"} ;
@@ -257,6 +276,7 @@ public abstract class ParserTestCase ext
         assertEquals("-1", cl.getOptionValue("b"));
     }
     
+    @Test
     public void testArgumentStartingWithHyphen() throws Exception
     {
         String[] args = new String[]{"-b", "-foo"};
@@ -265,6 +285,7 @@ public abstract class ParserTestCase ext
         assertEquals("-foo", cl.getOptionValue("b"));
     }
 
+    @Test
     public void testShortWithEqual() throws Exception
     {
         String[] args = new String[] { "-f=bar" };
@@ -277,6 +298,7 @@ public abstract class ParserTestCase ext
         assertEquals("bar", cl.getOptionValue("foo"));
     }
 
+    @Test
     public void testShortWithoutEqual() throws Exception
     {
         String[] args = new String[] { "-fbar" };
@@ -289,6 +311,7 @@ public abstract class ParserTestCase ext
         assertEquals("bar", cl.getOptionValue("foo"));
     }
 
+    @Test
     public void testLongWithEqualDoubleDash() throws Exception
     {
         String[] args = new String[] { "--foo=bar" };
@@ -301,6 +324,7 @@ public abstract class ParserTestCase ext
         assertEquals("bar", cl.getOptionValue("foo"));
     }
 
+    @Test
     public void testLongWithEqualSingleDash() throws Exception
     {
         String[] args = new String[] { "-foo=bar" };
@@ -313,6 +337,7 @@ public abstract class ParserTestCase ext
         assertEquals("bar", cl.getOptionValue("foo"));
     }
 
+    @Test
     public void testLongWithoutEqualSingleDash() throws Exception
     {
         String[] args = new String[] { "-foobar" };
@@ -325,6 +350,7 @@ public abstract class ParserTestCase ext
         assertEquals("bar", cl.getOptionValue("foo"));
     }
     
+    @Test
     public void testAmbiguousLongWithoutEqualSingleDash() throws Exception
     {
         String[] args = new String[] { "-b", "-foobar" };
@@ -340,6 +366,7 @@ public abstract class ParserTestCase ext
         assertEquals("bar", cl.getOptionValue("foo"));
     }
 
+    @Test
     public void testLongWithoutEqualDoubleDash() throws Exception
     {
         String[] args = new String[] { "--foobar" };
@@ -352,6 +379,7 @@ public abstract class ParserTestCase ext
         assertFalse(cl.hasOption("foo")); // foo isn't expected to be recognized with a double dash
     }
 
+    @Test
     public void testLongWithUnexpectedArgument1() throws Exception
     {
         String[] args = new String[] { "--foo=bar" };
@@ -372,6 +400,7 @@ public abstract class ParserTestCase ext
         fail("UnrecognizedOptionException not thrown");
     }
 
+    @Test
     public void testLongWithUnexpectedArgument2() throws Exception
     {
         String[] args = new String[] { "-foobar" };
@@ -392,6 +421,7 @@ public abstract class ParserTestCase ext
         fail("UnrecognizedOptionException not thrown");
     }
 
+    @Test
     public void testShortWithUnexpectedArgument() throws Exception
     {
         String[] args = new String[] { "-f=bar" };
@@ -412,6 +442,7 @@ public abstract class ParserTestCase ext
         fail("UnrecognizedOptionException not thrown");
     }
     
+    @Test
     public void testPropertiesOption1() throws Exception
     {
         String[] args = new String[] { "-Jsource=1.5", "-J", "target", "1.5", "foo" };
@@ -434,6 +465,7 @@ public abstract class ParserTestCase ext
         assertEquals("Expecting foo", "foo", argsleft.get(0));
     }
 
+    @Test
     public void testPropertiesOption2() throws Exception
     {
         String[] args = new String[] { "-Dparam1", "-Dparam2=value2", "-D"};
@@ -453,6 +485,7 @@ public abstract class ParserTestCase ext
         assertEquals("Should be no arg left", 0, argsleft.size());
     }
 
+    @Test
     public void testUnambiguousPartialLongOption1() throws Exception
     {
         String[] args = new String[] { "--ver" };
@@ -466,6 +499,7 @@ public abstract class ParserTestCase ext
         assertTrue("Confirm --version is set", cl.hasOption("version"));
     }
 
+    @Test
     public void testUnambiguousPartialLongOption2() throws Exception
     {
         String[] args = new String[] { "-ver" };
@@ -479,6 +513,7 @@ public abstract class ParserTestCase ext
         assertTrue("Confirm --version is set", cl.hasOption("version"));
     }
 
+    @Test
     public void testUnambiguousPartialLongOption3() throws Exception
     {
         String[] args = new String[] { "--ver=1" };
@@ -493,6 +528,7 @@ public abstract class ParserTestCase ext
         assertEquals("1", cl.getOptionValue("verbose"));
     }
 
+    @Test
     public void testUnambiguousPartialLongOption4() throws Exception
     {
         String[] args = new String[] { "-ver=1" };
@@ -507,6 +543,7 @@ public abstract class ParserTestCase ext
         assertEquals("1", cl.getOptionValue("verbose"));
     }
     
+    @Test
     public void testAmbiguousPartialLongOption1() throws Exception
     {
         String[] args = new String[] { "--ver" };
@@ -532,6 +569,7 @@ public abstract class ParserTestCase ext
         assertTrue( "Confirm MissingArgumentException caught", caught );
     }
     
+    @Test
     public void testAmbiguousPartialLongOption2() throws Exception
     {
         String[] args = new String[] { "-ver" };
@@ -557,6 +595,7 @@ public abstract class ParserTestCase ext
         assertTrue( "Confirm MissingArgumentException caught", caught );
     }
 
+    @Test
     public void testAmbiguousPartialLongOption3() throws Exception
     {
         String[] args = new String[] { "--ver=1" };
@@ -582,6 +621,7 @@ public abstract class ParserTestCase ext
         assertTrue( "Confirm MissingArgumentException caught", caught );
     }
 
+    @Test
     public void testAmbiguousPartialLongOption4() throws Exception
     {
         String[] args = new String[] { "-ver=1" };
@@ -607,6 +647,7 @@ public abstract class ParserTestCase ext
         assertTrue( "Confirm MissingArgumentException caught", caught );
     }
     
+    @Test
     public void testPartialLongOptionSingleDash() throws Exception
     {
         String[] args = new String[] { "-ver" };
@@ -621,6 +662,7 @@ public abstract class ParserTestCase ext
         assertTrue("Confirm -v is not set", !cl.hasOption("v"));
     }
 
+    @Test
     public void testWithRequiredOption() throws Exception
     {
         String[] args = new String[] { "-b", "file" };
@@ -637,6 +679,7 @@ public abstract class ParserTestCase ext
         assertTrue("Confirm NO of extra args", cl.getArgList().size() == 0);
     }
 
+    @Test
     public void testOptionAndRequiredOption() throws Exception
     {
         String[] args = new String[] { "-a", "-b", "file" };
@@ -653,6 +696,7 @@ public abstract class ParserTestCase ext
         assertTrue("Confirm NO of extra args", cl.getArgList().size() == 0);
     }
 
+    @Test
     public void testMissingRequiredOption()
     {
         String[] args = new String[] { "-a" };
@@ -677,6 +721,7 @@ public abstract class ParserTestCase ext
         }
     }
 
+    @Test
     public void testMissingRequiredOptions()
     {
         String[] args = new String[] { "-a" };
@@ -703,6 +748,7 @@ public abstract class ParserTestCase ext
         }
     }
     
+    @Test
     public void testMissingRequiredGroup() throws Exception
     {
         OptionGroup group = new OptionGroup();
@@ -730,6 +776,7 @@ public abstract class ParserTestCase ext
         }
     }
     
+    @Test
     public void testOptionGroup() throws Exception
     {
         OptionGroup group = new OptionGroup();
@@ -744,6 +791,7 @@ public abstract class ParserTestCase ext
         assertEquals("selected option", "b", group.getSelected());
     }
 
+    @Test
     public void testOptionGroupLong() throws Exception
     {
         OptionGroup group = new OptionGroup();
@@ -759,6 +807,7 @@ public abstract class ParserTestCase ext
         assertEquals("selected option", "bar", group.getSelected());
     }
     
+    @Test
     public void testReuseOptionsTwice() throws Exception
     {
         Options opts = new Options();
@@ -779,6 +828,7 @@ public abstract class ParserTestCase ext
         }
     }
 
+    @Test
     public void testBursting() throws Exception
     {
         String[] args = new String[] { "-acbtoast", "foo", "bar" };
@@ -792,6 +842,7 @@ public abstract class ParserTestCase ext
         assertTrue( "Confirm size of extra args", cl.getArgList().size() == 2);
     }
 
+    @Test
     public void testUnrecognizedOptionWithBursting() throws Exception
     {
         String[] args = new String[] { "-adbtoast", "foo", "bar" };
@@ -807,6 +858,7 @@ public abstract class ParserTestCase ext
         }
     }
 
+    @Test
     public void testMissingArgWithBursting() throws Exception
     {
         String[] args = new String[] { "-acb" };
@@ -826,6 +878,7 @@ public abstract class ParserTestCase ext
         assertTrue( "Confirm MissingArgumentException caught", caught );
     }
 
+    @Test
     public void testStopBursting() throws Exception
     {
         String[] args = new String[] { "-azc" };
@@ -838,6 +891,7 @@ public abstract class ParserTestCase ext
         assertTrue(cl.getArgList().contains("zc"));
     }
 
+    @Test
     public void testStopBursting2() throws Exception
     {
         String[] args = new String[] { "-c", "foobar", "-btoast" };
@@ -855,6 +909,7 @@ public abstract class ParserTestCase ext
         assertTrue("Confirm  value of extra arg: " + cl.getArgList().get(0), cl.getArgList().get(0).equals("foobar"));
     }
 
+    @Test
     public void testUnlimitedArgs() throws Exception
     {
         String[] args = new String[]{"-e", "one", "two", "-f", "alpha"};
@@ -882,6 +937,7 @@ public abstract class ParserTestCase ext
         }
     }
 
+    @Test
     public void testPropertyOptionSingularValue() throws Exception
     {
         Options opts = new Options();
@@ -896,6 +952,7 @@ public abstract class ParserTestCase ext
         assertTrue( !cmd.hasOption("fake") );
     }
 
+    @Test
     public void testPropertyOptionFlags() throws Exception
     {
         Options opts = new Options();
@@ -955,6 +1012,7 @@ public abstract class ParserTestCase ext
         assertTrue(cmd.hasOption("c"));
     } 
 
+    @Test
     public void testPropertyOptionMultipleValues() throws Exception
     {
         Options opts = new Options();
@@ -970,6 +1028,7 @@ public abstract class ParserTestCase ext
         assertTrue( Arrays.equals( values, cmd.getOptionValues('k') ) );
     }
 
+    @Test
     public void testPropertyOverrideValues() throws Exception
     {
         Options opts = new Options();
@@ -989,6 +1048,7 @@ public abstract class ParserTestCase ext
         assertTrue( !cmd.hasOption("fake") );
     }
 
+    @Test
     public void testPropertyOptionRequired() throws Exception
     {
         Options opts = new Options();
@@ -1001,6 +1061,7 @@ public abstract class ParserTestCase ext
         assertTrue(cmd.hasOption("f"));
     }
 
+    @Test
     public void testPropertyOptionUnexpected() throws Exception
     {
         Options opts = new Options();
@@ -1016,6 +1077,7 @@ public abstract class ParserTestCase ext
         }
     }
 
+    @Test
     public void testPropertyOptionGroup() throws Exception
     {
         Options opts = new Options();

Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/PatternOptionBuilderTest.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/PatternOptionBuilderTest.java?rev=1442904&r1=1442903&r2=1442904&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/PatternOptionBuilderTest.java (original)
+++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/PatternOptionBuilderTest.java Wed Feb  6 10:57:45 2013
@@ -17,22 +17,27 @@
 
 package org.apache.commons.cli;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.io.File;
 import java.net.URL;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.Vector;
 
-import junit.framework.TestCase;
+import org.junit.Test;
 
 /** 
- * Test case for the PatternOptionBuilder class 
- *
- * @version $Revision$, $Date$
+ * Test case for the PatternOptionBuilder class.
  */
 @SuppressWarnings("deprecation") // tests some deprecated classes
-public class PatternOptionBuilderTest extends TestCase
+public class PatternOptionBuilderTest
 {
+    @Test
     public void testSimplePattern() throws Exception
     {
         Options options = PatternOptionBuilder.parsePattern("a:b@cde>f+n%t/m*z#");
@@ -79,12 +84,14 @@ public class PatternOptionBuilderTest ex
         }
     }
 
+    @Test
     public void testEmptyPattern() throws Exception
     {
         Options options = PatternOptionBuilder.parsePattern("");
         assertTrue(options.getOptions().isEmpty());
     }
 
+    @Test
     public void testUntypedPattern() throws Exception
     {
         Options options = PatternOptionBuilder.parsePattern("abc");
@@ -99,6 +106,7 @@ public class PatternOptionBuilderTest ex
         assertNull("value c", line.getOptionObject('c'));
     }
 
+    @Test
     public void testNumberPattern() throws Exception
     {
         Options options = PatternOptionBuilder.parsePattern("n%d%x%");
@@ -114,6 +122,7 @@ public class PatternOptionBuilderTest ex
         assertNull("x object", line.getOptionObject("x"));
     }
 
+    @Test
     public void testClassPattern() throws Exception
     {
         Options options = PatternOptionBuilder.parsePattern("c+d+");
@@ -124,6 +133,7 @@ public class PatternOptionBuilderTest ex
         assertNull("d value", line.getOptionObject("d"));
     }
 
+    @Test
     public void testObjectPattern() throws Exception
     {
         Options options = PatternOptionBuilder.parsePattern("o@i@n@");
@@ -135,6 +145,7 @@ public class PatternOptionBuilderTest ex
         assertNull("n value", line.getOptionObject("n"));
     }
 
+    @Test
     public void testURLPattern() throws Exception
     {
         Options options = PatternOptionBuilder.parsePattern("u/v/");
@@ -145,6 +156,7 @@ public class PatternOptionBuilderTest ex
         assertNull("v value", line.getOptionObject("v"));
     }
 
+    @Test
     public void testExistingFilePattern() throws Exception
     {
         Options options = PatternOptionBuilder.parsePattern("f<");
@@ -156,6 +168,7 @@ public class PatternOptionBuilderTest ex
         // todo test if an error is returned if the file doesn't exists (when it's implemented)
     }
 
+    @Test
     public void testRequiredOption() throws Exception
     {
         Options options = PatternOptionBuilder.parsePattern("!n%m%");

Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/PosixParserTest.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/PosixParserTest.java?rev=1442904&r1=1442903&r2=1442904&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/PosixParserTest.java (original)
+++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/PosixParserTest.java Wed Feb  6 10:57:45 2013
@@ -17,15 +17,15 @@
 
 package org.apache.commons.cli;
 
+import org.junit.Before;
+
 /**
  * Test case for the PosixParser.
- *
- * @version $Revision$, $Date$
  */
 public class PosixParserTest extends ParserTestCase
 {
     @SuppressWarnings("deprecation")
-    @Override
+    @Before
     public void setUp()
     {
         super.setUp();

Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/UtilTest.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/UtilTest.java?rev=1442904&r1=1442903&r2=1442904&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/UtilTest.java (original)
+++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/UtilTest.java Wed Feb  6 10:57:45 2013
@@ -17,13 +17,14 @@
 
 package org.apache.commons.cli;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
 
-/**
- * @author brianegge
- */
-public class UtilTest extends TestCase
+import org.junit.Test;
+
+public class UtilTest
 {
+    @Test
     public void testStripLeadingHyphens()
     {
         assertEquals("f", Util.stripLeadingHyphens("-f"));
@@ -32,6 +33,7 @@ public class UtilTest extends TestCase
         assertNull(Util.stripLeadingHyphens(null));
     }
 
+    @Test
     public void testStripLeadingAndTrailingQuotes()
     {
         assertEquals("foo", Util.stripLeadingAndTrailingQuotes("\"foo\""));

Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ValueTest.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ValueTest.java?rev=1442904&r1=1442903&r2=1442904&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ValueTest.java (original)
+++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ValueTest.java Wed Feb  6 10:57:45 2013
@@ -17,15 +17,21 @@
 
 package org.apache.commons.cli;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Before;
+import org.junit.Test;
 
 @SuppressWarnings("deprecation") // tests some deprecated classes
-public class ValueTest extends TestCase
+public class ValueTest
 {
     private CommandLine _cl = null;
     private Options opts = new Options();
 
-    @Override
+    @Before
     public void setUp() throws Exception
     {
         opts.addOption("a", false, "toggle -a");
@@ -50,12 +56,14 @@ public class ValueTest extends TestCase
         _cl = parser.parse(opts,args);
     }
 
+    @Test
     public void testShortNoArg()
     {
         assertTrue( _cl.hasOption("a") );
         assertNull( _cl.getOptionValue("a") );
     }
 
+    @Test
     public void testShortWithArg()
     {
         assertTrue( _cl.hasOption("b") );
@@ -63,12 +71,14 @@ public class ValueTest extends TestCase
         assertEquals( _cl.getOptionValue("b"), "foo");
     }
 
+    @Test
     public void testLongNoArg()
     {
         assertTrue( _cl.hasOption("c") );
         assertNull( _cl.getOptionValue("c") );
     }
 
+    @Test
     public void testLongWithArg()
     {
         assertTrue( _cl.hasOption("d") );
@@ -76,6 +86,7 @@ public class ValueTest extends TestCase
         assertEquals( _cl.getOptionValue("d"), "bar");
     }
 
+    @Test
     public void testShortOptionalArgNoValue() throws Exception
     {
         String[] args = new String[] { "-e" };
@@ -86,6 +97,7 @@ public class ValueTest extends TestCase
         assertNull( cmd.getOptionValue("e") );
     }
 
+    @Test
     public void testShortOptionalArgValue() throws Exception
     {
         String[] args = new String[] { "-e", "everything" };
@@ -96,6 +108,7 @@ public class ValueTest extends TestCase
         assertEquals( "everything", cmd.getOptionValue("e") );
     }
 
+    @Test
     public void testLongOptionalNoValue() throws Exception
     {
         String[] args = new String[] { "--fish" };
@@ -106,6 +119,7 @@ public class ValueTest extends TestCase
         assertNull( cmd.getOptionValue("fish") );
     }
 
+    @Test
     public void testLongOptionalArgValue() throws Exception
     {
         String[] args = new String[] { "--fish", "face" };
@@ -116,6 +130,7 @@ public class ValueTest extends TestCase
         assertEquals( "face", cmd.getOptionValue("fish") );
     }
 
+    @Test
     public void testShortOptionalArgValues() throws Exception
     {
         String[] args = new String[] { "-j", "ink", "idea" };
@@ -129,6 +144,7 @@ public class ValueTest extends TestCase
         assertEquals( cmd.getArgs().length, 0 );
     }
 
+    @Test
     public void testLongOptionalArgValues() throws Exception
     {
         String[] args = new String[] { "--gravy", "gold", "garden" };
@@ -142,6 +158,7 @@ public class ValueTest extends TestCase
         assertEquals( cmd.getArgs().length, 0 );
     }
 
+    @Test
     public void testShortOptionalNArgValues() throws Exception
     {
         String[] args = new String[] { "-i", "ink", "idea", "isotope", "ice" };
@@ -157,6 +174,7 @@ public class ValueTest extends TestCase
         assertEquals( "ice", cmd.getArgs()[1] );
     }
 
+    @Test
     public void testLongOptionalNArgValues() throws Exception
     {
         String[] args = new String[] { 

Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ValuesTest.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ValuesTest.java?rev=1442904&r1=1442903&r2=1442904&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ValuesTest.java (original)
+++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ValuesTest.java Wed Feb  6 10:57:45 2013
@@ -17,15 +17,20 @@
 
 package org.apache.commons.cli;
 
-import junit.framework.TestCase;
-import junitx.framework.ArrayAssert;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Before;
+import org.junit.Test;
 
 @SuppressWarnings("deprecation") // tests some deprecated classes
-public class ValuesTest extends TestCase
+public class ValuesTest
 {
     private CommandLine cmd;
 
-    @Override
+    @Before
     public void setUp() throws Exception
     {
         Options options = new Options();
@@ -65,6 +70,7 @@ public class ValuesTest extends TestCase
         cmd = parser.parse(options,args);
     }
 
+    @Test
     public void testShortArgs()
     {
         assertTrue("Option a is not set", cmd.hasOption("a"));
@@ -74,6 +80,7 @@ public class ValuesTest extends TestCase
         assertNull(cmd.getOptionValues("c"));
     }
 
+    @Test
     public void testShortArgsWithValue()
     {
         assertTrue("Option b is not set", cmd.hasOption("b"));
@@ -85,47 +92,52 @@ public class ValuesTest extends TestCase
         assertEquals(1, cmd.getOptionValues("d").length);
     }
 
+    @Test
     public void testMultipleArgValues()
     {
         assertTrue("Option e is not set", cmd.hasOption("e"));
-        ArrayAssert.assertEquals(new String[] { "one", "two" }, cmd.getOptionValues("e"));
+        assertArrayEquals(new String[] { "one", "two" }, cmd.getOptionValues("e"));
     }
 
+    @Test
     public void testTwoArgValues()
     {
         assertTrue("Option g is not set", cmd.hasOption("g"));
-        ArrayAssert.assertEquals(new String[] { "val1", "val2" }, cmd.getOptionValues("g"));
+        assertArrayEquals(new String[] { "val1", "val2" }, cmd.getOptionValues("g"));
     }
 
+    @Test
     public void testComplexValues()
     {
         assertTrue("Option i is not set", cmd.hasOption("i"));
         assertTrue("Option h is not set", cmd.hasOption("h"));
-        ArrayAssert.assertEquals(new String[] { "val1", "val2" }, cmd.getOptionValues("h"));
+        assertArrayEquals(new String[] { "val1", "val2" }, cmd.getOptionValues("h"));
     }
 
+    @Test
     public void testExtraArgs()
     {
-        ArrayAssert.assertEquals("Extra args", new String[] { "arg1", "arg2", "arg3" }, cmd.getArgs());
+        assertArrayEquals("Extra args", new String[] { "arg1", "arg2", "arg3" }, cmd.getArgs());
     }
 
+    @Test
     public void testCharSeparator()
     {
         // tests the char methods of CommandLine that delegate to the String methods
         assertTrue("Option j is not set", cmd.hasOption("j"));
         assertTrue("Option j is not set", cmd.hasOption('j'));
-        ArrayAssert.assertEquals(new String[] { "key", "value", "key", "value" }, cmd.getOptionValues("j"));
-        ArrayAssert.assertEquals(new String[] { "key", "value", "key", "value" }, cmd.getOptionValues('j'));
+        assertArrayEquals(new String[] { "key", "value", "key", "value" }, cmd.getOptionValues("j"));
+        assertArrayEquals(new String[] { "key", "value", "key", "value" }, cmd.getOptionValues('j'));
 
         assertTrue("Option k is not set", cmd.hasOption("k"));
         assertTrue("Option k is not set", cmd.hasOption('k'));
-        ArrayAssert.assertEquals(new String[] { "key1", "value1", "key2", "value2" }, cmd.getOptionValues("k"));
-        ArrayAssert.assertEquals(new String[] { "key1", "value1", "key2", "value2" }, cmd.getOptionValues('k'));
+        assertArrayEquals(new String[] { "key1", "value1", "key2", "value2" }, cmd.getOptionValues("k"));
+        assertArrayEquals(new String[] { "key1", "value1", "key2", "value2" }, cmd.getOptionValues('k'));
 
         assertTrue("Option m is not set", cmd.hasOption("m"));
         assertTrue("Option m is not set", cmd.hasOption('m'));
-        ArrayAssert.assertEquals(new String[] { "key", "value" }, cmd.getOptionValues("m"));
-        ArrayAssert.assertEquals(new String[] { "key", "value" }, cmd.getOptionValues('m'));
+        assertArrayEquals(new String[] { "key", "value" }, cmd.getOptionValues("m"));
+        assertArrayEquals(new String[] { "key", "value" }, cmd.getOptionValues('m'));
     }
 
     /**

Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI133Test.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI133Test.java?rev=1442904&r1=1442903&r2=1442904&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI133Test.java (original)
+++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI133Test.java Wed Feb  6 10:57:45 2013
@@ -17,19 +17,19 @@
 
 package org.apache.commons.cli.bug;
 
+import static org.junit.Assert.assertFalse;
+
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.Option;
 import org.apache.commons.cli.Options;
 import org.apache.commons.cli.ParseException;
 import org.apache.commons.cli.PosixParser;
+import org.junit.Test;
 
-import junit.framework.TestCase;
-
-/**
- * @author brianegge
- */
 @SuppressWarnings("deprecation") // tests some deprecated classes
-public class BugCLI133Test extends TestCase {
+public class BugCLI133Test
+{    
+    @Test
     public void testOrder() throws ParseException {
         Option optionA = new Option("a", "first");
         Options opts = new Options();

Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI13Test.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI13Test.java?rev=1442904&r1=1442903&r2=1442904&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI13Test.java (original)
+++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI13Test.java Wed Feb  6 10:57:45 2013
@@ -17,24 +17,25 @@
 
 package org.apache.commons.cli.bug;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.Option;
 import org.apache.commons.cli.OptionBuilder;
 import org.apache.commons.cli.Options;
 import org.apache.commons.cli.ParseException;
 import org.apache.commons.cli.PosixParser;
+import org.junit.Test;
 
-import junit.framework.TestCase;
-
-/**
- * @author brianegge
- */
 @SuppressWarnings("deprecation") // tests some deprecated classes
-public class BugCLI13Test extends TestCase
+public class BugCLI13Test
 {
+    @Test
     public void testCLI13() throws ParseException
     {
         final String debugOpt = "debug";
+        @SuppressWarnings("static-access")
         Option debug = OptionBuilder
             .withArgName( debugOpt )
             .withDescription( "turn on debugging" )

Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI148Test.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI148Test.java?rev=1442904&r1=1442903&r2=1442904&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI148Test.java (original)
+++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI148Test.java Wed Feb  6 10:57:45 2013
@@ -17,31 +17,33 @@
 
 package org.apache.commons.cli.bug;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.CommandLineParser;
 import org.apache.commons.cli.OptionBuilder;
 import org.apache.commons.cli.Options;
 import org.apache.commons.cli.PosixParser;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * http://issues.apache.org/jira/browse/CLI-148
- *
- * @author brianegge
  */
 @SuppressWarnings("deprecation") // tests some deprecated classes
-public class BugCLI148Test  extends TestCase
+public class BugCLI148Test
 {    
     private Options options;
 
-    @Override
-    protected void setUp() throws Exception
+    @Before
+    public void setUp() throws Exception
     {
         options = new Options();
         options.addOption(OptionBuilder.hasArg().create('t'));
         options.addOption(OptionBuilder.hasArg().create('s'));
     }
 
+    @Test
     public void testWorkaround1() throws Exception
     {
         CommandLineParser parser = new PosixParser();
@@ -51,6 +53,7 @@ public class BugCLI148Test  extends Test
         assertEquals("-something", commandLine.getOptionValue('t'));
     }
 
+    @Test
     public void testWorkaround2() throws Exception
     {
         CommandLineParser parser = new PosixParser();

Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI162Test.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI162Test.java?rev=1442904&r1=1442903&r2=1442904&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI162Test.java (original)
+++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI162Test.java Wed Feb  6 10:57:45 2013
@@ -15,25 +15,27 @@
  * limitations under the License.
  */
 
-
 package org.apache.commons.cli.bug;
 
+import static org.junit.Assert.assertEquals;
+
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.sql.ParameterMetaData;
 import java.sql.Types;
 
-import junit.framework.TestCase;
-
 import org.apache.commons.cli.HelpFormatter;
 import org.apache.commons.cli.Option;
 import org.apache.commons.cli.OptionGroup;
 import org.apache.commons.cli.Options;
+import org.junit.Test;
 
-public class BugCLI162Test extends TestCase {
+public class BugCLI162Test
+{
     /** Constant for the line separator.*/
     private static final String CR = System.getProperty("line.separator");
 
+    @Test
     public void testInfiniteLoop() {
         Options options = new Options();
         options.addOption("h", "help", false, "This is a looooong description");
@@ -42,6 +44,7 @@ public class BugCLI162Test extends TestC
         formatter.printHelp("app", options); // used to hang & crash
     }
 
+    @Test
     public void testPrintHelpLongLines() {
         // Constants used for options
         final String OPT = "-";
@@ -229,6 +232,7 @@ public class BugCLI162Test extends TestC
         new HelpFormatter().printHelp(this.getClass().getName(), commandLineOptions);
     }
 
+    @Test
     public void testLongLineChunking() {
         Options options = new Options();
         options.addOption("x", "extralongarg", false,
@@ -261,6 +265,7 @@ public class BugCLI162Test extends TestC
         assertEquals( "Long arguments did not split as expected", expected, sw.toString() );
     }
 
+    @Test
     public void testLongLineChunkingIndentIgnored() {
         Options options = new Options();
         options.addOption("x", "extralongarg", false, "This description is Long." );

Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI18Test.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI18Test.java?rev=1442904&r1=1442903&r2=1442904&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI18Test.java (original)
+++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI18Test.java Wed Feb  6 10:57:45 2013
@@ -23,14 +23,14 @@ import java.io.StringWriter;
 import org.apache.commons.cli.HelpFormatter;
 import org.apache.commons.cli.Option;
 import org.apache.commons.cli.Options;
-
-import junit.framework.TestCase;
+import org.junit.Test;
 
 /**
  * http://issues.apache.org/jira/browse/CLI-18
  */
-public class BugCLI18Test extends TestCase
+public class BugCLI18Test
 {
+    @Test
     public void testCLI18()
     {
         Options options = new Options();

Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI71Test.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI71Test.java?rev=1442904&r1=1442903&r2=1442904&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI71Test.java (original)
+++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI71Test.java Wed Feb  6 10:57:45 2013
@@ -15,25 +15,27 @@
  * limitations under the License.
  */
 
-
 package org.apache.commons.cli.bug;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.CommandLineParser;
 import org.apache.commons.cli.MissingArgumentException;
 import org.apache.commons.cli.Option;
 import org.apache.commons.cli.Options;
 import org.apache.commons.cli.PosixParser;
-
-import junit.framework.TestCase;
+import org.junit.Before;
+import org.junit.Test;
 
 @SuppressWarnings("deprecation") // tests some deprecated classes
-public class BugCLI71Test extends TestCase {
-
+public class BugCLI71Test
+{
     private Options options;
     private CommandLineParser parser;
 
-    @Override
+    @Before
     public void setUp() {
         options = new Options();
 
@@ -48,6 +50,7 @@ public class BugCLI71Test extends TestCa
         parser = new PosixParser();
     }
 
+    @Test
     public void testBasic() throws Exception {
         String[] args = new String[] { "-a", "Caesar", "-k", "A" };
         CommandLine line = parser.parse( options, args);
@@ -55,6 +58,7 @@ public class BugCLI71Test extends TestCa
         assertEquals( "A", line.getOptionValue("k") );
     }
 
+    @Test
     public void testMistakenArgument() throws Exception {
         String[] args = new String[] { "-a", "Caesar", "-k", "A" };
         CommandLine line = parser.parse( options, args);
@@ -64,6 +68,7 @@ public class BugCLI71Test extends TestCa
         assertEquals( "a", line.getOptionValue("k") );
     }
 
+    @Test
     public void testLackOfError() throws Exception {
         String[] args = new String[] { "-k", "-a",  "Caesar" };
         try {
@@ -74,6 +79,7 @@ public class BugCLI71Test extends TestCa
         }
     }
 
+    @Test
     public void testGetsDefaultIfOptional() throws Exception {
         String[] args = new String[] { "-k", "-a", "Caesar" };
         options.getOption("k").setOptionalArg(true);



Mime
View raw message