void () { final PatchHunk patchHunk = new PatchHunk(1, 8, 1, 8); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "1")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "2")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "3")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "2a")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "3a")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "4")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "5")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "6")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "7")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "6a")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "7a")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "8")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "9")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "10")); AppliedPatch result = GenericPatchApplier.apply("5\n6\n7\n8\n1\n2\n3\n4\n9\nextra line", Collections.singletonList(patchHunk)); Assert.assertNotNull(result); Assert.assertEquals(ApplyPatchStatus.SUCCESS, result.status); Assert.assertEquals("5\n6a\n7a\n8\n1\n2a\n3a\n4\n9\nextra line", result.patchedText); }