InternalGit implements IGit { @Override public void clone(String url) throws GitException { try { GitCloneCommand command = new GitCloneCommand(repo); command.setProgressMonitor(getProgressMonitor()); String giturl = mirrors.getNewUrl(url); command.setRemoteUrl(giturl); command.call(); } catch (Throwable t) { throw new GitException(t.getMessage(), t); } } InternalGit(File workDirectory, GitMirrors mirrors); @Override void checkoutBranch(String branchName); @Override void clone(String url); @Override boolean exists(); @Override String getCurrentBranch(); ProgressMonitor getProgressMonitor(); Repository getRepo(); RepositoryState getState(); @Override void pullRemote(); void setMonitor(ProgressMonitor progressMonitor); @Override File getDir();  }
@Test public void testClone() throws Throwable { testdir.ensureEmpty(); File repodir = testdir.getFile("repo"); FS.ensureDirExists(repodir); InternalGit repo = new InternalGit(repodir, new GitMirrors()); Assert.assertThat("repo.exist()", repo.exists(), is(false)); String url = "http: repo.setMonitor(new TerseProgressMonitor()); repo.clone(url); Assert.assertThat("repo.getCurrentBranch()", repo.getCurrentBranch(), is("refs/heads/master")); }