commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ebo...@apache.org
Subject svn commit: r661638 - /commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/HelpFormatterTest.java
Date Fri, 30 May 2008 10:30:48 GMT
Author: ebourg
Date: Fri May 30 03:30:48 2008
New Revision: 661638

URL: http://svn.apache.org/viewvc?rev=661638&view=rev
Log:
Full test coverage for HelpFormatter.rtrim()

Modified:
    commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/HelpFormatterTest.java

Modified: commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/HelpFormatterTest.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/HelpFormatterTest.java?rev=661638&r1=661637&r2=661638&view=diff
==============================================================================
--- commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/HelpFormatterTest.java
(original)
+++ commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/HelpFormatterTest.java
Fri May 30 03:30:48 2008
@@ -222,7 +222,8 @@
         assertEquals("usage: app [-c] [-b] [-a]" + EOL, bytesOut.toString());
     }
 
-    public void testPrintOptionGroupUsage() {
+    public void testPrintOptionGroupUsage()
+    {
         OptionGroup group = new OptionGroup();
         group.addOption(OptionBuilder.create("a"));
         group.addOption(OptionBuilder.create("b"));
@@ -239,7 +240,8 @@
         assertEquals("usage: app [-a | -b | -c]" + EOL, out.toString());
     }
 
-    public void testPrintRequiredOptionGroupUsage() {
+    public void testPrintRequiredOptionGroupUsage()
+    {
         OptionGroup group = new OptionGroup();
         group.addOption(OptionBuilder.create("a"));
         group.addOption(OptionBuilder.create("b"));
@@ -257,7 +259,8 @@
         assertEquals("usage: app -a | -b | -c" + EOL, out.toString());
     }
 
-    public void testPrintOptionWithEmptyArgNameUsage() {
+    public void testPrintOptionWithEmptyArgNameUsage()
+    {
         Option option = new Option("f", true, null);
         option.setArgName("");
         option.setRequired(true);
@@ -273,4 +276,19 @@
         assertEquals("usage: app -f" + EOL, out.toString());
     }
 
+    public void testRtrim()
+    {
+        HelpFormatter formatter = new HelpFormatter()
+        {
+            public String rtrim(String s)
+            {
+                return super.rtrim(s);
+            }
+        };
+
+        assertEquals(null, formatter.rtrim(null));
+        assertEquals("", formatter.rtrim(""));
+        assertEquals("  foo", formatter.rtrim("  foo  "));
+    }
+
 }



Mime
View raw message