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:31 UTC

[08/12] commons-cli git commit: change and add file in PatternOptionBuilderTest.java

change and add file in 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/1e59d0c2
Tree: http://git-wip-us.apache.org/repos/asf/commons-cli/tree/1e59d0c2
Diff: http://git-wip-us.apache.org/repos/asf/commons-cli/diff/1e59d0c2

Branch: refs/heads/master
Commit: 1e59d0c2fd1cfee450d0104734307306803a84e0
Parents: aea58f8
Author: Béla Schaum <sc...@gmail.com>
Authored: Mon Jun 12 22:46:32 2017 +0200
Committer: Béla Schaum <sc...@gmail.com>
Committed: Mon Jun 12 22:46:32 2017 +0200

----------------------------------------------------------------------
 .../org/apache/commons/cli/PatternOptionBuilderTest.java    | 9 ++++++---
 src/test/resources/existing-readable.file                   | 1 +
 2 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-cli/blob/1e59d0c2/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 82eacb5..ff92bc8 100644
--- a/src/test/java/org/apache/commons/cli/PatternOptionBuilderTest.java
+++ b/src/test/java/org/apache/commons/cli/PatternOptionBuilderTest.java
@@ -163,10 +163,13 @@ public class PatternOptionBuilderTest
     {
         final Options options = PatternOptionBuilder.parsePattern("f<g<");
         final CommandLineParser parser = new PosixParser();
-        final CommandLine line = parser.parse(options, new String[] { "-f", "test.properties", "-g", "/dev/null" });
+        final CommandLine line = parser.parse(options, new String[] { "-f", "non-existing.file", "-g", "src/test/resources/existing-readable.file" });
         
-        assertNotNull("option g not parsed, or not FileInputStream", (FileInputStream) line.getOptionObject("g"));
-        assertNull("option f parsed", (FileInputStream) line.getOptionObject("f"));
+        assertNull("option f parsed", line.getOptionObject("f"));
+
+        Object parsedReadableFileStream = line.getOptionObject("g");
+        assertNotNull("option g not parsed", parsedReadableFileStream);
+        assertEquals("option g not FileInputStream", FileInputStream.class, parsedReadableFileStream.getClass());
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/1e59d0c2/src/test/resources/existing-readable.file
----------------------------------------------------------------------
diff --git a/src/test/resources/existing-readable.file b/src/test/resources/existing-readable.file
new file mode 100644
index 0000000..5c3118d
--- /dev/null
+++ b/src/test/resources/existing-readable.file
@@ -0,0 +1 @@
+dummy file