Skip to content

Commit 5f8a570

Browse files
committed
Added a test for Options.toString()
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/cli/branches/cli-1.x@661607 13f79535-47bb-0310-9956-ffa450edef68
1 parent 9f086c5 commit 5f8a570

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/test/org/apache/commons/cli/OptionsTest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,15 @@ public void testMissingOptionsException() throws ParseException {
9797
}
9898
}
9999

100+
public void testToString() {
101+
Options options = new Options();
102+
options.addOption("f", "foo", true, "Foo");
103+
options.addOption("b", "bar", false, "Bar");
104+
105+
String s = options.toString();
106+
assertNotNull("null string returned", s);
107+
assertTrue("foo option missing", s.toLowerCase().indexOf("foo") != -1);
108+
assertTrue("bar option missing", s.toLowerCase().indexOf("bar") != -1);
109+
}
110+
100111
}

0 commit comments

Comments
 (0)