@Test public void testConvert() throws ArgumentParserException { FileArgumentType type = new FileArgumentType(); File file = type.convert(null, null, "foobar"); assertEquals("foobar", file.getName()); file = new FileArgumentType().verifyCanRead().acceptSystemIn() .convert(null, null, "-"); assertEquals("-", file.getName()); try { ArgumentParser ap = ArgumentParsers .newFor("argparse4j").locale(Locale.US).build(); new FileArgumentType().verifyCanRead().convert(ap, new MockArgument(), "-"); } catch (ArgumentParserException e) { assertEquals( "argument null: Insufficient permissions to read file: '-'", e.getMessage()); } }
@Override public File convert(ArgumentParser parser, Argument arg, String value) throws ArgumentParserException { File file = new File(value); if (!isSystemIn(file)) { firstFileVerification.verify(parser, arg, file); } return file; }
FileArgumentType implements ArgumentType<File> { @Override public File convert(ArgumentParser parser, Argument arg, String value) throws ArgumentParserException { File file = new File(value); if (!isSystemIn(file)) { firstFileVerification.verify(parser, arg, file); } return file; } }
FileArgumentType implements ArgumentType<File> { @Override public File convert(ArgumentParser parser, Argument arg, String value) throws ArgumentParserException { File file = new File(value); if (!isSystemIn(file)) { firstFileVerification.verify(parser, arg, file); } return file; } FileArgumentType(); }
FileArgumentType implements ArgumentType<File> { @Override public File convert(ArgumentParser parser, Argument arg, String value) throws ArgumentParserException { File file = new File(value); if (!isSystemIn(file)) { firstFileVerification.verify(parser, arg, file); } return file; } FileArgumentType(); FileArgumentType acceptSystemIn(); FileArgumentType verifyExists(); FileArgumentType verifyNotExists(); FileArgumentType verifyIsFile(); FileArgumentType verifyIsDirectory(); FileArgumentType verifyCanRead(); FileArgumentType verifyCanWrite(); FileArgumentType verifyCanWriteParent(); FileArgumentType verifyCanCreate(); FileArgumentType verifyCanExecute(); FileArgumentType verifyIsAbsolute(); FileArgumentType or(); @Override File convert(ArgumentParser parser, Argument arg, String value); }
FileArgumentType implements ArgumentType<File> { @Override public File convert(ArgumentParser parser, Argument arg, String value) throws ArgumentParserException { File file = new File(value); if (!isSystemIn(file)) { firstFileVerification.verify(parser, arg, file); } return file; } FileArgumentType(); FileArgumentType acceptSystemIn(); FileArgumentType verifyExists(); FileArgumentType verifyNotExists(); FileArgumentType verifyIsFile(); FileArgumentType verifyIsDirectory(); FileArgumentType verifyCanRead(); FileArgumentType verifyCanWrite(); FileArgumentType verifyCanWriteParent(); FileArgumentType verifyCanCreate(); FileArgumentType verifyCanExecute(); FileArgumentType verifyIsAbsolute(); FileArgumentType or(); @Override File convert(ArgumentParser parser, Argument arg, String value);  }