void () { final PatchHunk patchHunk = new PatchHunk(2, 9, 2, 12); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "c2")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "c2")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "c3")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "a1")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "c4")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "a2")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "a3")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "c5")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "c6")); AppliedPatch result = GenericPatchApplier.apply("c2\nc2\nc3\nc4\n\nc5\nc6\nw\nw\n\nAn\nw\n\n\n", Collections.singletonList(patchHunk)); Assert.assertEquals(ApplyPatchStatus.SUCCESS, result.status); Assert.assertEquals("c2\nc2\nc3\na1\nc4\na2\na3\n\nc5\nc6\nw\nw\n\nAn\nw\n\n\n", result.patchedText); }