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