void () { final PatchHunk patchHunk = new PatchHunk(0, 1, 0, 3); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "y")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "x")); PatchLine line = new PatchLine(PatchLine.Type.ADD, "z"); line.setSuppressNewLine(true); patchHunk.addLine(line); AppliedPatch result = GenericPatchApplier.apply("x\n", Collections.singletonList(patchHunk)); Assert.assertNotNull(result); Assert.assertEquals(ApplyPatchStatus.SUCCESS, result.status); Assert.assertEquals("y\nx\nz", result.patchedText); }