@Test
void applyDecisionsOnLinesConflicts() throws Exception
{

    MergeResult<String> result;
    MergeConfiguration<String> mergeConfiguration;
    // Test 1: All content has changed between previous and current
    result = diffManager.merge(
        Arrays.asList("Line 1", "Line 2", "Line 3"),
        Arrays.asList("Line 1", "Line 2 modified", "Line 3"),
        Arrays.asList("Line 1", "Line 2 another change", "Line 3"), null);
    assertEquals(1, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(1, result.getConflicts().size());
    Conflict<String> conflict = createConflict(1, "Line 2", "Line 2 another change", "Line 2 modified");
    assertEquals(conflict, result.getConflicts().get(0));
    assertEquals(Arrays.asList("Line 1", "Line 2 another change", "Line 3"), result.getMerged());
    ConflictDecision<String> conflictDecision = new DefaultConflictDecision<>(conflict);
    conflictDecision.setType(ConflictDecision.DecisionType.PREVIOUS);
    List<ConflictDecision<String>> conflictDecisionList = new ArrayList<>();
    conflictDecisionList.add(conflictDecision);
    mergeConfiguration = new MergeConfiguration<>(conflictDecisionList);
    result = diffManager.merge(
        Arrays.asList("Line 1", "Line 2", "Line 3"),
        Arrays.asList("Line 1", "Line 2 modified", "Line 3"),
        Arrays.asList("Line 1", "Line 2 another change", "Line 3"), mergeConfiguration);
    assertTrue(result.getConflicts().isEmpty());
    assertTrue(result.getLog().getLogs(LogLevel.ERROR).isEmpty());
    assertEquals(Arrays.asList("Line 1", "Line 2", "Line 3"), result.getMerged());
    conflictDecision.setType(ConflictDecision.DecisionType.NEXT);
    result = diffManager.merge(
        Arrays.asList("Line 1", "Line 2", "Line 3"),
        Arrays.asList("Line 1", "Line 2 modified", "Line 3"),
        Arrays.asList("Line 1", "Line 2 another change", "Line 3"), mergeConfiguration);
    assertTrue(result.getConflicts().isEmpty());
    assertTrue(result.getLog().getLogs(LogLevel.ERROR).isEmpty());
    assertEquals(Arrays.asList("Line 1", "Line 2 modified", "Line 3"), result.getMerged());
    conflictDecision.setType(ConflictDecision.DecisionType.CURRENT);
    result = diffManager.merge(
        Arrays.asList("Line 1", "Line 2", "Line 3"),
        Arrays.asList("Line 1", "Line 2 modified", "Line 3"),
        Arrays.asList("Line 1", "Line 2 another change", "Line 3"), mergeConfiguration);
    assertTrue(result.getConflicts().isEmpty());
    assertTrue(result.getLog().getLogs(LogLevel.ERROR).isEmpty());
    assertEquals(Arrays.asList("Line 1", "Line 2 another change", "Line 3"), result.getMerged());
    conflictDecision.setType(ConflictDecision.DecisionType.UNDECIDED);
    result = diffManager.merge(
        Arrays.asList("Line 1", "Line 2", "Line 3"),
        Arrays.asList("Line 1", "Line 2 modified", "Line 3"),
        Arrays.asList("Line 1", "Line 2 another change", "Line 3"), mergeConfiguration);
    assertEquals(1, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(1, result.getConflicts().size());
    assertEquals(conflict, result.getConflicts().get(0));
    assertEquals(Arrays.asList("Line 1", "Line 2 another change", "Line 3"), result.getMerged());
    conflictDecision.setCustom(Arrays.asList("Another complete custom change", "and a line"));
    result = diffManager.merge(
        Arrays.asList("Line 1", "Line 2", "Line 3"),
        Arrays.asList("Line 1", "Line 2 modified", "Line 3"),
        Arrays.asList("Line 1", "Line 2 another change", "Line 3"), mergeConfiguration);
    assertTrue(result.getConflicts().isEmpty());
    assertTrue(result.getLog().getLogs(LogLevel.ERROR).isEmpty());
    assertEquals(Arrays.asList("Line 1", "Another complete custom change", "and a line", "Line 3"),
        result.getMerged());
    conflictDecisionList = new ArrayList<>();
    conflict = this.createConflict(1,
        Type.CHANGE, 1, 1, Arrays.asList("Second line.", "Third line."), Arrays.asList("Second line.", "Line N°4"),
        Type.CHANGE, 1, 1, Arrays.asList("Second line.", "Third line."), Arrays.asList("Line N°2", "Third line."));
    conflictDecision = new DefaultConflictDecision<>(conflict);
    conflictDecision.setCustom(Arrays.asList("Something", "Completely", "Different"));
    conflictDecisionList.add(conflictDecision);
    Conflict<String> conflict2 = this.createConflict(5,
        Type.CHANGE, 5, 5, Collections.emptyList(), Arrays.asList("6th line."),
        Type.CHANGE, 5, 5, Collections.emptyList(), Arrays.asList("Sixth line."));
    conflictDecision = new DefaultConflictDecision<>(conflict2);
    conflictDecision.setType(ConflictDecision.DecisionType.PREVIOUS);
    conflictDecisionList.add(conflictDecision);
    mergeConfiguration = new MergeConfiguration<>(conflictDecisionList);
    result = this.diffManager.merge(
        Arrays.asList(
            "First line.",
            "Second line.",
            "Third line.",
            "Fourth line.",
            "Fifth line.",
            "Seventh line."
        ), Arrays.asList(
            "First line.",
            "Line N°2",
            "Third line.",
            "Fifth line.",
            "Sixth line.",
            "Seventh line."
        ), Arrays.asList(
            "First line.",
            "Second line.",
            "Line N°4",
            "Fifth line.",
            "6th line.",
            "Seventh line."
        ), mergeConfiguration);
    assertEquals(0, result.getConflicts().size());
    assertEquals(Arrays.asList(
        "First line.",
        "Something",
        "Completely",
        "Different",
        "Fifth line.",
        "Seventh line."
    ), result.getMerged());
}