void () { final PatchHunk patchHunk1 = new PatchHunk(1, 2, 1, 1); patchHunk1.addLine(new PatchLine(PatchLine.Type.CONTEXT, "1")); patchHunk1.addLine(new PatchLine(PatchLine.Type.REMOVE, "2")); int[] beforeOfsetExpected = {3, 7, 9, 11}; int[] afterOfsetExpected = {2, 6, 7, 9}; final PatchHunk patchHunk2 = new PatchHunk(3, 12, 2, 11); patchHunk2.addLine(new PatchLine(PatchLine.Type.CONTEXT, "1")); patchHunk2.addLine(new PatchLine(PatchLine.Type.CONTEXT, "2")); patchHunk2.addLine(new PatchLine(PatchLine.Type.REMOVE, "3")); patchHunk2.addLine(new PatchLine(PatchLine.Type.REMOVE, "4")); patchHunk2.addLine(new PatchLine(PatchLine.Type.ADD, "5")); patchHunk2.addLine(new PatchLine(PatchLine.Type.ADD, "6")); patchHunk2.addLine(new PatchLine(PatchLine.Type.CONTEXT, "7")); patchHunk2.addLine(new PatchLine(PatchLine.Type.REMOVE, "8")); patchHunk2.addLine(new PatchLine(PatchLine.Type.CONTEXT, "9")); patchHunk2.addLine(new PatchLine(PatchLine.Type.REMOVE, "10")); patchHunk2.addLine(new PatchLine(PatchLine.Type.ADD, "11")); patchHunk2.addLine(new PatchLine(PatchLine.Type.CONTEXT, "12")); patchHunk2.addLine(new PatchLine(PatchLine.Type.ADD, "13")); patchHunk2.addLine(new PatchLine(PatchLine.Type.CONTEXT, "14")); patchHunk2.addLine(new PatchLine(PatchLine.Type.CONTEXT, "15")); List<GenericPatchApplier.SplitHunk> hunks1 = GenericPatchApplier.SplitHunk.read(patchHunk1); List<GenericPatchApplier.SplitHunk> hunks2 = GenericPatchApplier.SplitHunk.read(patchHunk2); assertEquals(1, hunks1.size()); assertEquals(4, hunks2.size()); final GenericPatchApplier.SplitHunk splitHunk = hunks1.get(0); assertEquals(1, splitHunk.getStartLineBefore()); assertEquals(1, splitHunk.getStartLineAfter()); for (int i = 0; i < hunks2.size(); i++) { assertEquals(beforeOfsetExpected[i], hunks2.get(i).getStartLineBefore()); assertEquals(afterOfsetExpected[i], hunks2.get(i).getStartLineAfter()); } }