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.ADD, "c")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "11")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "12")); AppliedSomehowPatch result = GenericPatchApplier.applySomehow("0\nmmm\nfjsfsd\nqwhduhqwude\n\n2\na\n9\n8\n11\naaa", Collections.singletonList(patchHunk)); Assert.assertTrue(result.isAppliedSomehow); Assert.assertEquals(ApplyPatchStatus.ALREADY_APPLIED, result.status); Assert.assertEquals("0\nmmm\nfjsfsd\nqwhduhqwude\n\n2\na\nb\nc\n9\n8\n11\naaa", result.patchedText); }