CliGitAdd implements IGitAdd { public GitAddResponse add(File repositoryPath, GitAddOptions options, List<File> paths) throws JavaGitException, IOException { CheckUtilities.checkFileValidity(repositoryPath); GitAddParser parser = new GitAddParser(); List<String> command = buildCommand(repositoryPath, options, paths); GitAddResponseImpl response = (GitAddResponseImpl) ProcessUtilities.runCommand(repositoryPath, command, parser); if (options != null) { addDryRun(options, response); } return (GitAddResponse) response; }  GitAddResponse add(File repositoryPath, GitAddOptions options, List<File> paths); GitAddResponse add(File repositoryPath, List<File> files); GitAddResponse add(File repositoryPath, File file); GitAddResponse add(File repositoryPath, GitAddOptions options, File file); GitAddResponse addDryRun(File repositoryPath, List<File> paths); GitAddResponse addVerbose(File repositoryPath, List<File> paths); GitAddResponse addWithForce(File repositoryPath, List<File> paths);  }
@Test public void testGitAddNullRepositoryPath() throws IOException, JavaGitException { try { CliGitAdd gitAdd = new CliGitAdd(); GitAddOptions options = null; List<File> files = null; gitAdd.add(null, options, files); } catch (NullPointerException e) { return; } fail("Failed to throw NullPointerException"); }
@Test(expected = IOException.class) public void testGitAddIOExceptionThrown() throws IOException, JavaGitException { try { CliGitAdd gitAdd = new CliGitAdd(); GitAddOptions options = null; List<File> fileNames = new ArrayList<File>(); fileNames.add(new File("testFile")); gitAdd.add(new File("repo/path/should/not/exist"), options, fileNames); } catch (IOException e) { return; } fail("IOException not thrown"); }