Source:
<code>public void checkMergeCrissCross(MergeStrategy strategy) throws Exception { Git git = Git.wrap(db); writeTrashFile("1", "1\n2\n3"); git.add().addFilepattern("1").call(); RevCommit first = git.commit().setMessage("added 1").call(); writeTrashFile("1", "1master\n2\n3"); RevCommit masterCommit = git.commit().setAll(true) .setMessage("modified 1 on master").call(); writeTrashFile("1", "1master2\n2\n3"); git.commit().setAll(true) .setMessage("modified 1 on master again").call(); git.checkout().setCreateBranch(true).setStartPoint(first) .setName("side").call(); writeTrashFile("1", "1\n2\na\nb\nc\n3side"); RevCommit sideCommit = git.commit().setAll(true) .setMessage("modified 1 on side").call(); writeTrashFile("1", "1\n2\n3side2"); git.commit().setAll(true) .setMessage("modified 1 on side again").call(); MergeResult result = git.merge().setStrategy(strategy) .include(masterCommit).call(); assertEquals(MergeStatus.MERGED, result.getMergeStatus()); result.getNewHead(); git.checkout().setName("master").call(); result = git.merge().setStrategy(strategy).include(sideCommit).call(); assertEquals(MergeStatus.MERGED, result.getMergeStatus()); try { MergeResult mergeResult = git.merge().setStrategy(strategy) .include(git.getRepository().getRef("refs/heads/side")) .call(); assertEquals(MergeStrategy.RECURSIVE, strategy); assertEquals(MergeResult.MergeStatus.MERGED, mergeResult.getMergeStatus()); assertEquals("1master2\n2\n3side2\n", read("1")); <START> } catch (JGitInternalException e) { <END> assertEquals(MergeStrategy.RESOLVE, strategy); } }</code><technical_language>this exception-test more specific. JGitInternalException is a wrapper for checked exceptions idea are. should't throw this type for merge failure</technical_language>

Target:
public void checkMergeCrissCross(MergeStrategy strategy) throws Exception { Git git = Git.wrap(db); writeTrashFile("1", "1\n2\n3"); git.add().addFilepattern("1").call(); RevCommit first = git.commit().setMessage("added 1").call(); writeTrashFile("1", "1master\n2\n3"); RevCommit masterCommit = git.commit().setAll(true) .setMessage("modified 1 on master").call(); writeTrashFile("1", "1master2\n2\n3"); git.commit().setAll(true) .setMessage("modified 1 on master again").call(); git.checkout().setCreateBranch(true).setStartPoint(first) .setName("side").call(); writeTrashFile("1", "1\n2\na\nb\nc\n3side"); RevCommit sideCommit = git.commit().setAll(true) .setMessage("modified 1 on side").call(); writeTrashFile("1", "1\n2\n3side2"); git.commit().setAll(true) .setMessage("modified 1 on side again").call(); MergeResult result = git.merge().setStrategy(strategy) .include(masterCommit).call(); assertEquals(MergeStatus.MERGED, result.getMergeStatus()); result.getNewHead(); git.checkout().setName("master").call(); result = git.merge().setStrategy(strategy).include(sideCommit).call(); assertEquals(MergeStatus.MERGED, result.getMergeStatus()); try { MergeResult mergeResult = git.merge().setStrategy(strategy) .include(git.getRepository().getRef("refs/heads/side")) .call(); assertEquals(MergeStrategy.RECURSIVE, strategy); assertEquals(MergeResult.MergeStatus.MERGED, mergeResult.getMergeStatus()); assertEquals("1master2\n2\n3side2\n", read("1")); } catch (JGitInternalException e) { assertEquals(MergeStrategy.RESOLVE, strategy); assertTrue(e.getCause() instanceof NoMergeBaseException); assertEquals(((NoMergeBaseException) e.getCause()).getReason(), MergeBaseFailureReason.MULTIPLE_MERGE_BASES_NOT_SUPPORTED); } }