void () { final PatchHunk patchHunk = new PatchHunk(1, 8, 1, 8); 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.REMOVE, "5")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "a")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "b")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "11")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "12")); AppliedPatch result = GenericPatchApplier.apply("0\n0\n0\n2\n3\n4\n5\n\n\n5454\n5345\n2\n3\n4\n5\n11\n543543", Collections.singletonList(patchHunk)); Assert.assertNotNull(result); Assert.assertEquals("0\n0\n0\n2\n3\n4\n5\n\n\n5454\n5345\n2\na\nb\n11\n543543", result.patchedText); }