void () { int[] beforeAppliedExpected = {5, 8, 10, 12}; int[] afterAppliedExpected = {7, 9, 11, 12}; final PatchHunk patchHunk = new PatchHunk(2, 12, 2, 12); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "1")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "2")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "3")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "4")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "5")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "6")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "7")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "8")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "9")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "10")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "11")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "12")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "13")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "14")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "15")); final GenericPatchApplier gap = new GenericPatchApplier("0\n0werewrewr\n\n1\n2\n3\n4\n7\n8\n9\n10\n12\n14\n", Collections.singletonList(patchHunk)); assertTrue(gap.execute()); checkAppliedPositions(beforeAppliedExpected, afterAppliedExpected, HunkStatus.EXACTLY_APPLIED, gap.getAppliedInfo()); }