Update PatternOptionBuilderTest.java
diff --git a/src/test/java/org/apache/commons/cli/PatternOptionBuilderTest.java b/src/test/java/org/apache/commons/cli/PatternOptionBuilderTest.java
index 1b3bdfc..b74dc5e 100644
--- a/src/test/java/org/apache/commons/cli/PatternOptionBuilderTest.java
+++ b/src/test/java/org/apache/commons/cli/PatternOptionBuilderTest.java
@@ -24,6 +24,7 @@
import static org.junit.Assert.fail;
import java.io.File;
+import java.io.FileInputStream;
import java.net.URL;
import java.util.Calendar;
import java.util.Date;
@@ -159,13 +160,20 @@
@Test
public void testExistingFilePattern() throws Exception
{
- Options options = PatternOptionBuilder.parsePattern("f<");
+ Options options = PatternOptionBuilder.parsePattern("f<g<");
CommandLineParser parser = new PosixParser();
- CommandLine line = parser.parse(options, new String[] { "-f", "test.properties" });
-
- assertEquals("f value", new File("test.properties"), line.getOptionObject("f"));
-
- // todo test if an error is returned if the file doesn't exists (when it's implemented)
+ CommandLine line = parser.parse(options, new String[] { "-f", "test.properties", "-g", "build.xml" });
+
+ assertNotNull((FileInputStream) line.getOptionObject("g"));
+
+ try
+ {
+ line.getOptionObject("f");
+ fail("ParseException wasn't thrown");
+ }
+ catch (ParseException e)
+ {
+ }
}
@Test