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.ADD, "5")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "11")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "12")); AppliedSomehowPatch result = GenericPatchApplier.applySomehow("1\n2\n3=*7\n11\n12", Collections.singletonList(patchHunk)); Assert.assertTrue(result.isAppliedSomehow); Assert.assertEquals(ApplyPatchStatus.SUCCESS, result.status); Assert.assertEquals("1\n2\n5\n3=*7\n11\n12", result.patchedText); }