import static org.junit.Assert.assertTrue;
import java.io.File;
+import java.io.IOException;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DefaultLogger;
private GitCloneTask task;
private Project project;
+ private File dest;
@Before
- public void before() {
+ public void before() throws IOException {
project = new Project();
+ project.init();
enableLogging();
project.addTaskDefinition("git-clone", GitCloneTask.class);
task = (GitCloneTask) project.createTask("git-clone");
+ dest = createTempFile();
+ task.setDest(dest);
}
@Test(expected = BuildException.class)
FileRepository repo = createBareRepository();
File directory = repo.getDirectory();
task.setUri("file://" + directory);
- File dest = createTempFile();
- task.setDest(dest);
task.execute();
assertTrue(RepositoryCache.FileKey.isGitRepository(new File(dest, ".git"), FS.DETECTED));
File directory = repo.getDirectory();
task.setUri("file://" + directory);
task.setBare(true);
- File dest = createTempFile();
- task.setDest(dest);
task.execute();
assertTrue(RepositoryCache.FileKey.isGitRepository(dest, FS.DETECTED));