### Question:
UIGit extends VCS implements IVCS { @Override public String diff( String oldCommitId, String newCommitId ) throws Exception { return diff( oldCommitId, newCommitId, null ); }  @Override String getType(); @Override String getDirectory(); @Override String getAuthorName( String commitId ); @Override String getCommitMessage( String commitId ); @Override String getCommitId( String revstr ); @Override String getParentCommitId( String revstr ); @Override String getBranch(); @Override List<String> getLocalBranches(); @Override List<String> getBranches(); @Override String getRemote(); @Override void addRemote( String value ); @Override void removeRemote(); @Override boolean hasRemote(); @Override boolean commit( String authorName, String message ); @Override List<ObjectRevision> getRevisions(); @Override List<UIFile> getUnstagedFiles(); @Override List<UIFile> getStagedFiles(); @Override List<UIFile> getStagedFiles( String oldCommitId, String newCommitId ); @Override boolean hasStagedFiles(); @Override void initRepo( String baseDirectory ); @Override void openRepo( String baseDirectory ); @Override void closeRepo(); @Override void add( String filepattern ); @Override void rm( String filepattern ); @Override void reset( String name ); @Override void resetPath( String path ); @Override boolean rollback( String name ); @Override boolean pull(); @Override boolean push(); @Override boolean push( String type ); @Override String diff( String oldCommitId, String newCommitId ); @Override String diff( String oldCommitId, String newCommitId, String file ); @Override InputStream open( String file, String commitId ); boolean cloneRepo( String directory, String uri ); @Override void checkout( String name ); @Override void checkoutBranch( String name ); @Override void checkoutTag( String name ); @Override void revertPath( String path ); @Override boolean createBranch( String value ); @Override boolean deleteBranch( String name, boolean force ); @Override boolean merge(); @Override String getShortenedName( String name, String type ); @Override boolean isClean(); @Override List<String> getTags(); @Override boolean createTag( String name ); @Override boolean deleteTag( String name ); @Override String getExpandedName( String name, String type ); @Override void setCredential( String username, String password );  }### Answer:
@Test public void testDiff() throws Exception { File file = writeTrashFile( "Test.txt", "Hello world" ); String diff = uiGit.diff( IVCS.INDEX, uiGit.getShortenedName( IVCS.WORKINGTREE, IVCS.TYPE_COMMIT ), "Test.txt" ); assertTrue( diff.contains( "+Hello world" ) ); git.add().addFilepattern( "Test.txt" ).call(); RevCommit commit1 = git.commit().setMessage( "initial commit" ).call(); diff = uiGit.diff( null, commit1.getName(), "Test.txt" ); assertTrue( diff.contains( "+Hello world" ) ); String diff2 = uiGit.diff( null, uiGit.getShortenedName( commit1.getName(), IVCS.TYPE_COMMIT ), "Test.txt" ); assertEquals( diff, diff2 ); FileUtils.writeStringToFile( file, "second commit" ); git.add().addFilepattern( "Test.txt" ).call(); RevCommit commit2 = git.commit().setMessage( "second commit" ).call(); diff = uiGit.diff( commit1.getName(), IVCS.WORKINGTREE ); assertTrue( diff.contains( "-Hello world" ) ); assertTrue( diff.contains( "+second commit" ) ); diff = uiGit.diff( commit1.getName(), commit2.getName() ); assertTrue( diff.contains( "+second commit" ) ); }