JGitFlowInitCommand initCommand = new JGitFlowInitCommand();
JGitFlow flow = initCommand.setDirectory(git.getRepository().getWorkTree()).call();
git.push().setRemote("origin").add("develop").call();
HotfixStartExtensionForTests extension = new HotfixStartExtensionForTests();
extension.withException(BaseExtensionForTests.AFTER_CREATE_BRANCH, ExtensionFailStrategy.WARN);
//do a commit to the remote develop branch
remoteGit.checkout().setName("master").call();
File junkFile = new File(remoteGit.getRepository().getWorkTree(), "junk.txt");
FileUtils.writeStringToFile(junkFile, "I am junk");
remoteGit.add().addFilepattern(junkFile.getName()).call();
remoteGit.commit().setMessage("adding junk file").call();
//update local
git.checkout().setName("master").call();
git.pull().call();
git.checkout().setName("develop").call();
flow.hotfixStart("1.0").setFetch(true).setPush(true).setExtension(extension).call();
assertEquals(flow.getHotfixBranchPrefix() + "1.0", git.getRepository().getBranch());
assertTrue("before was not called", extension.wasCalled(BaseExtensionForTests.BEFORE));
assertTrue("beforeFetch was not called", extension.wasCalled(BaseExtensionForTests.BEFORE_FETCH));
assertTrue("afterFetch was not called", extension.wasCalled(BaseExtensionForTests.AFTER_FETCH));
assertTrue("beforeCreateBranch was not called", extension.wasCalled(BaseExtensionForTests.BEFORE_CREATE_BRANCH));
assertTrue("afterCreateBranch was not called", extension.wasCalled(BaseExtensionForTests.AFTER_CREATE_BRANCH));
assertTrue("afterPush was not called", extension.wasCalled(BaseExtensionForTests.AFTER_PUSH));
assertTrue("after was not called", extension.wasCalled(BaseExtensionForTests.AFTER));
}