GitStatus { public GitStatusResponse status(File repositoryPath, GitStatusOptions options, List<File> paths) throws JavaGitException, IOException { CheckUtilities.checkFileValidity(repositoryPath); IClient client = ClientManager.getInstance().getPreferredClient(); IGitStatus gitStatus = client.getGitStatusInstance(); return gitStatus.status(repositoryPath, options, paths); }  GitStatusResponse status(File repositoryPath, GitStatusOptions options, List<File> paths); GitStatusResponse status(File repositoryPath, List<File> paths); GitStatusResponse status(File repositoryPath, GitStatusOptions options); GitStatusResponse status(File repositoryPath, GitStatusOptions options, File file); GitStatusResponse status(File repositoryPath); GitStatusResponse statusAll(File repositoryPath); GitStatusResponse getSingleFileStatus(File repositoryPath, File path); GitFileSystemObject.Status getFileStatus(File repositoryPath, File path);  }
@Test public void testReadyToCommitNewFiles() throws IOException, JavaGitException { List<File> filesToAdd = new ArrayList<File>(); filesToAdd.add(file1); filesToAdd.add(file2); filesToAdd.add(new File("testDirectory")); filesToAdd.add(new File("testDirectory" + File.separator + file3.getPath())); GitAddOptions addOptions = new GitAddOptions(); gitAdd.add(repositoryDirectory, addOptions, filesToAdd); List<File> statusPath = null; GitStatusResponse status = gitStatus.status(repositoryDirectory, options, statusPath); int noOfNewFilesToCommit = status.getNewFilesToCommitSize(); assertEquals("Error. No of New Files to commit does not match", 3, noOfNewFilesToCommit); assertEquals("Error. Filename does not match", "foobar01", status .getFileFromNewFilesToCommit(0).getName()); assertEquals("Error. Filename does not match", "foobar02", status .getFileFromNewFilesToCommit(1).getName()); assertEquals("Error. Filename does not match", repositoryDirectory.getPath() + File.separator + "testDirectory" + File.separator + "foobar03", status.getFileFromNewFilesToCommit(2).toString()); }
@Test public void testModifiedNotUpdatedFiles() throws IOException, JavaGitException { List<File> filesToAdd = new ArrayList<File>(); filesToAdd.add(file1); filesToAdd.add(file2); filesToAdd.add(new File("testDirectory")); filesToAdd.add(new File("testDirectory" + File.separator + file3.getPath())); GitAddOptions addOptions = new GitAddOptions(); gitAdd.add(repositoryDirectory, addOptions, filesToAdd); gitCommit.commit(repositoryDirectory, "Test commit of two files"); FileUtilities.modifyFileContents(new File(repositoryDirectory.getPath() + File.separator + file1.getPath()), "Test append text\n"); FileUtilities.modifyFileContents(new File(testDir.getPath() + File.separator + file3.getPath()), "Another sample text added to foobar03\n"); List<File> statusPath = null; GitStatusResponse status = gitStatus.status(repositoryDirectory, options, statusPath); checkModifiedFiles(status); if (new File(repositoryDirectory.getPath() + File.separator + file2.getPath()).delete()) { status = gitStatus.status(repositoryDirectory, options, statusPath); if (JavaGitConfiguration.getGitVersionObject().compareTo(new GitVersion("1.7.0")) == GitVersion.LATER) { assertEquals("No of deleted files not equal", 1, status.getDeletedFilesToCommitSize()); } else { assertEquals("No of deleted files not equal", 1, status.getDeletedFilesNotUpdatedSize()); } checkModifiedFiles(status); } else { fail("Failed to delete file \"foobar02\""); } }