Import implements Command { @Override public void validate(HashMap<String, Object> args) throws ValidationException { String dir = (String) args.get(DIRECTORY_OPTION); if (!Files.isDirectory(Paths.get(dir))) { throw new ValidationException("directory " + dir + "does not exist"); } }  @Override String getCommandName(); @Override void run(HashMap<String, Object> args); @Override Options getOptions(); @Override void validate(HashMap<String, Object> args);  }
@Test public void validate() throws ValidationException { Command command = new Import(); HashMap<String, Object> args = new HashMap<String, Object>(); args.put("d", ImportTest.class.getClassLoader().getResource("testRootDir1").getPath()); command.validate(args); }
@Test(expected = ValidationException.class) public void validationFail() throws ValidationException { Command command = new Import(); HashMap<String, Object> args = new HashMap<String, Object>(); args.put("d", "invalidDir"); command.validate(args); }