commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From britter <>
Subject [GitHub] commons-cli pull request #12: [CLI-274] implement EXISTING_FILE_VALUE type h...
Date Mon, 12 Jun 2017 18:39:35 GMT
Github user britter commented on a diff in the pull request:
    --- Diff: src/test/java/org/apache/commons/cli/ ---
    @@ -159,13 +161,12 @@ public void testURLPattern() throws Exception
         public void testExistingFilePattern() throws Exception
    -        final Options options = PatternOptionBuilder.parsePattern("f<");
    +        final Options options = PatternOptionBuilder.parsePattern("f<g<");
             final CommandLineParser parser = new PosixParser();
    -        final CommandLine line = parser.parse(options, new String[] { "-f", ""
    -        assertEquals("f value", new File(""), line.getOptionObject("f"));
    -        // todo test if an error is returned if the file doesn't exists (when it's implemented)
    +        final CommandLine line = parser.parse(options, new String[] { "-f", "",
"-g", "/dev/null" });
    +        assertNotNull("option g not parsed, or not FileInputStream", (FileInputStream)
    +        assertNull("option f parsed", (FileInputStream) line.getOptionObject("f"));
    --- End diff --
    > Yes, It is null because does not exist, or not readable. This can
be made clearer somehow.
    Maybe by calling it `non-existing.file`?
    > Another task is to find a cross-platform file which is exist (and not /dev/null).
    You could put add dummy file in `src/test/resources` and use that one.

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at or file a JIRA ticket
with INFRA.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message