void () { final PatchHunk patchHunk = new PatchHunk(1, 8, 1, 8); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "1c")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "2c")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "3c")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "2r")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "2r")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "3a")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "3c")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "2r")); 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("sdsad\nsdsad\n1c\n2c\n3c\n2r\n8\n9\n10\n", Collections.singletonList(patchHunk)); Assert.assertNotNull(result); Assert.assertEquals(ApplyPatchStatus.SUCCESS, result.status); Assert.assertEquals("sdsad\nsdsad\n1c\n2c\n3c\n2r\n3a\n3c\n2r\n8\n9\n10\n", result.patchedText); }