void () { // IDEA-189699 final PatchHunk patchHunk = new PatchHunk(0, 4, 0, 7); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "X")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "Y")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "a")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "b")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "Z")); AppliedPatch result = GenericPatchApplier.apply("X\n\nY\nZ\n", Collections.singletonList(patchHunk)); Assert.assertNotNull(result); Assert.assertEquals(ApplyPatchStatus.SUCCESS, result.status); Assert.assertEquals("X\n\n\nY\na\nb\nZ\n", result.patchedText); }