commons-commits mailing list archives

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

URL: http://svn.apache.org/viewvc?rev=661649&view=rev
Log:
Added tests for the accessors of HelpFormatter

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=661649&r1=661648&r2=661649&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 04:13:13 2008
@@ -308,4 +308,33 @@
         assertEquals("  foo", formatter.rtrim("  foo  "));
     }
 
+    public void testAccessors()
+    {
+        HelpFormatter formatter = new HelpFormatter();
+
+        formatter.setArgName("argname");
+        assertEquals("arg name", "argname", formatter.getArgName());
+
+        formatter.setDescPadding(3);
+        assertEquals("desc padding", 3, formatter.getDescPadding());
+
+        formatter.setLeftPadding(7);
+        assertEquals("left padding", 7, formatter.getLeftPadding());
+
+        formatter.setLongOptPrefix("~~");
+        assertEquals("long opt prefix", "~~", formatter.getLongOptPrefix());
+
+        formatter.setNewLine("\n");
+        assertEquals("new line", "\n", formatter.getNewLine());
+
+        formatter.setOptPrefix("~");
+        assertEquals("opt prefix", "~", formatter.getOptPrefix());
+
+        formatter.setSyntaxPrefix("-> ");
+        assertEquals("syntax prefix", "-> ", formatter.getSyntaxPrefix());
+
+        formatter.setWidth(80);
+        assertEquals("width", 80, formatter.getWidth());
+    }
+
 }



Mime
View raw message