You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by br...@apache.org on 2017/06/14 07:57:26 UTC

[03/12] commons-cli git commit: Update PatternOptionBuilderTest.java

Update PatternOptionBuilderTest.java

Project: http://git-wip-us.apache.org/repos/asf/commons-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-cli/commit/9039cbd4
Tree: http://git-wip-us.apache.org/repos/asf/commons-cli/tree/9039cbd4
Diff: http://git-wip-us.apache.org/repos/asf/commons-cli/diff/9039cbd4

Branch: refs/heads/master
Commit: 9039cbd454346276c632ae2424a3c20e18a2d276
Parents: a315e18
Author: Bela Schaum <sc...@users.noreply.github.com>
Authored: Mon Apr 17 16:21:42 2017 +0200
Committer: GitHub <no...@github.com>
Committed: Mon Apr 17 16:21:42 2017 +0200

----------------------------------------------------------------------
 .../commons/cli/PatternOptionBuilderTest.java   | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-cli/blob/9039cbd4/src/test/java/org/apache/commons/cli/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.assertTrue;
 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 @@ public class PatternOptionBuilderTest
     @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