@Test
void applyDecisionsOnMergeCharConflicts() throws Exception
{

    MergeResult<Character> result;
    MergeConfiguration<Character> mergeConfiguration;
    Conflict<Character> conflict;
    ConflictDecision<Character> conflictDecision;
    List<ConflictDecision<Character>> allConflictDecisions;
    List<Character> emptyList = Collections.emptyList();
    List<Character> onlyA = toCharacters("a");
    List<Character> onlyB = toCharacters("b");
    List<Character> onlyC = toCharacters("c");
    // New empty
    conflict = createConflict(0,
        Type.CHANGE, 0, 0, onlyA, onlyB,
        Type.CHANGE, 0, 0, onlyA, emptyList);
    conflictDecision = new DefaultConflictDecision<>(conflict);
    conflictDecision.setType(ConflictDecision.DecisionType.UNDECIDED);
    allConflictDecisions = Collections.singletonList(conflictDecision);
    mergeConfiguration = new MergeConfiguration<>(allConflictDecisions);
    result = this.diffManager.merge(onlyA, emptyList, onlyB, mergeConfiguration);
    assertEquals(1, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(1, result.getConflicts().size());
    assertEquals(conflict, result.getConflicts().get(0));
    assertEquals(onlyB, result.getMerged());
    conflictDecision.setType(ConflictDecision.DecisionType.CURRENT);
    result = this.diffManager.merge(onlyA, emptyList, onlyB, mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals(onlyB, result.getMerged());
    conflictDecision.setType(ConflictDecision.DecisionType.PREVIOUS);
    result = this.diffManager.merge(onlyA, emptyList, onlyB, mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals(onlyA, result.getMerged());
    conflictDecision.setType(ConflictDecision.DecisionType.NEXT);
    result = this.diffManager.merge(onlyA, emptyList, onlyB, mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals(emptyList, result.getMerged());
    conflictDecision.setCustom(Arrays.asList('x', 'y'));
    result = this.diffManager.merge(onlyA, emptyList, onlyB, mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals(Arrays.asList('x', 'y'), result.getMerged());
    // Current and new at the same place
    conflict = createConflict(0, 'a', 'c', 'b');
    conflictDecision = new DefaultConflictDecision<>(conflict);
    allConflictDecisions = Collections.singletonList(conflictDecision);
    mergeConfiguration = new MergeConfiguration<>(allConflictDecisions);
    conflictDecision.setType(ConflictDecision.DecisionType.UNDECIDED);
    result = this.diffManager.merge(onlyA, onlyB, onlyC, mergeConfiguration);
    assertEquals(1, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(1, result.getConflicts().size());
    assertEquals(conflict, result.getConflicts().get(0));
    assertEquals(onlyC, result.getMerged());
    conflictDecision.setType(ConflictDecision.DecisionType.CURRENT);
    result = this.diffManager.merge(onlyA, onlyB, onlyC, mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals(onlyC, result.getMerged());
    conflictDecision.setType(ConflictDecision.DecisionType.PREVIOUS);
    result = this.diffManager.merge(onlyA, onlyB, onlyC, mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals(onlyA, result.getMerged());
    conflictDecision.setType(ConflictDecision.DecisionType.NEXT);
    result = this.diffManager.merge(onlyA, onlyB, onlyC, mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals(onlyB, result.getMerged());
    conflictDecision.setCustom(Collections.emptyList());
    result = this.diffManager.merge(onlyA, onlyB, onlyC, mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals(Collections.emptyList(), result.getMerged());
    // Current and new in conflict at different indices
    conflict = createConflict(0,
        Type.CHANGE, 0, 0, Arrays.asList('a', 'b'), Arrays.asList('a', 'z'),
        Type.CHANGE, 0, 0, Arrays.asList('a', 'b'), Arrays.asList('y', 'y'));
    conflictDecision = new DefaultConflictDecision<>(conflict);
    allConflictDecisions = Collections.singletonList(conflictDecision);
    mergeConfiguration = new MergeConfiguration<>(allConflictDecisions);
    conflictDecision.setType(ConflictDecision.DecisionType.UNDECIDED);
    result = this.diffManager
        .merge(toCharacters("abcd"), toCharacters("yycd"), toCharacters("azzd"), mergeConfiguration);
    assertEquals(1, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(1, result.getConflicts().size());
    assertEquals(conflict, result.getConflicts().get(0));
    assertEquals("azzd", toString(result.getMerged()));
    conflictDecision.setType(ConflictDecision.DecisionType.CURRENT);
    result = this.diffManager
        .merge(toCharacters("abcd"), toCharacters("yycd"), toCharacters("azzd"), mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals("azzd", toString(result.getMerged()));
    conflictDecision.setType(ConflictDecision.DecisionType.PREVIOUS);
    result = this.diffManager
        .merge(toCharacters("abcd"), toCharacters("yycd"), toCharacters("azzd"), mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals("abcd", toString(result.getMerged()));
    conflictDecision.setType(ConflictDecision.DecisionType.NEXT);
    result = this.diffManager
        .merge(toCharacters("abcd"), toCharacters("yycd"), toCharacters("azzd"), mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals("yycd", toString(result.getMerged()));
    conflictDecision.setCustom(toCharacters("Something else"));
    result = this.diffManager
        .merge(toCharacters("abcd"), toCharacters("yycd"), toCharacters("azzd"), mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals("Something elsed", toString(result.getMerged()));
    // Current and new in conflict at different indices
    conflict = createConflict(0,
        Type.CHANGE, 0, 0, Arrays.asList('a', 'b'), Arrays.asList('y', 'y'),
        Type.CHANGE, 0, 0, Arrays.asList('a', 'b'), Arrays.asList('a', 'z'));
    conflictDecision = new DefaultConflictDecision<>(conflict);
    allConflictDecisions = Collections.singletonList(conflictDecision);
    mergeConfiguration = new MergeConfiguration<>(allConflictDecisions);
    conflictDecision.setType(ConflictDecision.DecisionType.UNDECIDED);
    result = this.diffManager
        .merge(toCharacters("abcd"), toCharacters("azzd"), toCharacters("yycd"), mergeConfiguration);
    assertEquals(1, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(1, result.getConflicts().size());
    assertEquals(conflict, result.getConflicts().get(0));
    assertEquals("yycd", toString(result.getMerged()));
    conflictDecision.setType(ConflictDecision.DecisionType.CURRENT);
    result = this.diffManager
        .merge(toCharacters("abcd"), toCharacters("azzd"), toCharacters("yycd"), mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals("yycd", toString(result.getMerged()));
    conflictDecision.setType(ConflictDecision.DecisionType.PREVIOUS);
    result = this.diffManager
        .merge(toCharacters("abcd"), toCharacters("azzd"), toCharacters("yycd"), mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals("abcd", toString(result.getMerged()));
    conflictDecision.setType(ConflictDecision.DecisionType.NEXT);
    result = this.diffManager
        .merge(toCharacters("abcd"), toCharacters("azzd"), toCharacters("yycd"), mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals("azzd", toString(result.getMerged()));
    conflictDecision.setCustom(Collections.singletonList('x'));
    result = this.diffManager
        .merge(toCharacters("abcd"), toCharacters("azzd"), toCharacters("yycd"), mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals("xd", toString(result.getMerged()));
    // New overlapping current
    conflict = createConflict(0,
        Type.CHANGE, 0, 0, Arrays.asList('a', 'a', 'b', 'b'), Arrays.asList('d', 'd', 'd', 'd'),
        Type.CHANGE, 0, 0, Arrays.asList('a', 'a', 'b', 'b'), Arrays.asList('a', 'r', 'r', 'b'));
    conflictDecision = new DefaultConflictDecision<>(conflict);
    allConflictDecisions = Collections.singletonList(conflictDecision);
    mergeConfiguration = new MergeConfiguration<>(allConflictDecisions);
    conflictDecision.setType(ConflictDecision.DecisionType.UNDECIDED);
    result = this.diffManager
        .merge(toCharacters("aabbcc"), toCharacters("arrbcc"), toCharacters("ddddcc"), mergeConfiguration);
    assertEquals(1, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(1, result.getConflicts().size());
    assertEquals(conflict, result.getConflicts().get(0));
    assertEquals("ddddcc", toString(result.getMerged()));
    conflictDecision.setType(ConflictDecision.DecisionType.CURRENT);
    result = this.diffManager
        .merge(toCharacters("aabbcc"), toCharacters("arrbcc"), toCharacters("ddddcc"), mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals("ddddcc", toString(result.getMerged()));
    conflictDecision.setType(ConflictDecision.DecisionType.PREVIOUS);
    result = this.diffManager
        .merge(toCharacters("aabbcc"), toCharacters("arrbcc"), toCharacters("ddddcc"), mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals("aabbcc", toString(result.getMerged()));
    conflictDecision.setType(ConflictDecision.DecisionType.NEXT);
    result = this.diffManager
        .merge(toCharacters("aabbcc"), toCharacters("arrbcc"), toCharacters("ddddcc"), mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals("arrbcc", toString(result.getMerged()));
    conflictDecision.setCustom(toCharacters("anything"));
    result = this.diffManager
        .merge(toCharacters("aabbcc"), toCharacters("arrbcc"), toCharacters("ddddcc"), mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals("anythingcc", toString(result.getMerged()));
    // current overlapping new
    conflict = createConflict(0,
        Type.CHANGE, 0, 0, Arrays.asList('a', 'a', 'b', 'b'), Arrays.asList('a', 'r', 'r', 'b'),
        Type.CHANGE, 0, 0, Arrays.asList('a', 'a', 'b', 'b'), Arrays.asList('d', 'd', 'd', 'd'));
    conflictDecision = new DefaultConflictDecision<>(conflict);
    allConflictDecisions = Collections.singletonList(conflictDecision);
    mergeConfiguration = new MergeConfiguration<>(allConflictDecisions);
    conflictDecision.setType(ConflictDecision.DecisionType.UNDECIDED);
    result = this.diffManager
        .merge(toCharacters("aabbcc"), toCharacters("ddddcc"), toCharacters("arrbcc"), mergeConfiguration);
    assertEquals(1, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(1, result.getConflicts().size());
    assertEquals(conflict, result.getConflicts().get(0));
    assertEquals("arrbcc", toString(result.getMerged()));
    conflictDecision.setType(ConflictDecision.DecisionType.CURRENT);
    result = this.diffManager
        .merge(toCharacters("aabbcc"), toCharacters("ddddcc"), toCharacters("arrbcc"), mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals("arrbcc", toString(result.getMerged()));
    conflictDecision.setType(ConflictDecision.DecisionType.PREVIOUS);
    result = this.diffManager
        .merge(toCharacters("aabbcc"), toCharacters("ddddcc"), toCharacters("arrbcc"), mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals("aabbcc", toString(result.getMerged()));
    conflictDecision.setType(ConflictDecision.DecisionType.NEXT);
    result = this.diffManager
        .merge(toCharacters("aabbcc"), toCharacters("ddddcc"), toCharacters("arrbcc"), mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals("ddddcc", toString(result.getMerged()));
    conflictDecision.setCustom(Collections.emptyList());
    result = this.diffManager
        .merge(toCharacters("aabbcc"), toCharacters("ddddcc"), toCharacters("arrbcc"), mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals("cc", toString(result.getMerged()));
    // Multiple conflicts
    conflict = createConflict(0,
        Type.CHANGE, 0, 0, Arrays.asList('a', 'a', 'b', 'b'), Arrays.asList('a', 'r', 'r', 'b'),
        Type.CHANGE, 0, 0, Arrays.asList('a', 'a', 'b', 'b'), Arrays.asList('d', 'd', 'd', 'd'));
    Conflict<Character> conflict1 = createConflict(7,
        Type.CHANGE, 7, 7, Arrays.asList('a', 'b'), Arrays.asList('y', 'y'),
        Type.CHANGE, 7, 7, Arrays.asList('a', 'b'), Arrays.asList('a', 'z'));
    allConflictDecisions = new ArrayList<>();
    conflictDecision = new DefaultConflictDecision<>(conflict);
    allConflictDecisions.add(conflictDecision);
    ConflictDecision<Character> conflictDecision1 = new DefaultConflictDecision<>(conflict1);
    allConflictDecisions.add(conflictDecision1);
    conflictDecision.setType(ConflictDecision.DecisionType.UNDECIDED);
    conflictDecision1.setType(ConflictDecision.DecisionType.UNDECIDED);
    mergeConfiguration = new MergeConfiguration<>(allConflictDecisions);
    result = this.diffManager
        .merge(toCharacters("aabbcc abcd"), toCharacters("ddddcc azzd"), toCharacters("arrbcc yycd"),
            mergeConfiguration);
    assertEquals(2, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(2, result.getConflicts().size());
    assertEquals(conflict, result.getConflicts().get(0));
    assertEquals(conflict1, result.getConflicts().get(1));
    assertEquals("arrbcc yycd", toString(result.getMerged()));
    conflictDecision.setType(ConflictDecision.DecisionType.CURRENT);
    conflictDecision1.setType(ConflictDecision.DecisionType.CURRENT);
    result = this.diffManager
        .merge(toCharacters("aabbcc abcd"), toCharacters("ddddcc azzd"), toCharacters("arrbcc yycd"),
            mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals("arrbcc yycd", toString(result.getMerged()));
    conflictDecision.setType(ConflictDecision.DecisionType.PREVIOUS);
    conflictDecision1.setType(ConflictDecision.DecisionType.PREVIOUS);
    result = this.diffManager
        .merge(toCharacters("aabbcc abcd"), toCharacters("ddddcc azzd"), toCharacters("arrbcc yycd"),
            mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals("aabbcc abcd", toString(result.getMerged()));
    conflictDecision.setType(ConflictDecision.DecisionType.NEXT);
    conflictDecision1.setType(ConflictDecision.DecisionType.NEXT);
    result = this.diffManager
        .merge(toCharacters("aabbcc abcd"), toCharacters("ddddcc azzd"), toCharacters("arrbcc yycd"),
            mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals("ddddcc azzd", toString(result.getMerged()));
    conflictDecision.setCustom(toCharacters("A first change"));
    conflictDecision1.setCustom(toCharacters("and another one"));
    result = this.diffManager
        .merge(toCharacters("aabbcc abcd"), toCharacters("ddddcc azzd"), toCharacters("arrbcc yycd"),
            mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals("A first changecc and another oned", toString(result.getMerged()));
    conflictDecision.setType(ConflictDecision.DecisionType.CURRENT);
    conflictDecision1.setType(ConflictDecision.DecisionType.NEXT);
    result = this.diffManager
        .merge(toCharacters("aabbcc abcd"), toCharacters("ddddcc azzd"), toCharacters("arrbcc yycd"),
            mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals("arrbcc azzd", toString(result.getMerged()));
    conflictDecision.setType(ConflictDecision.DecisionType.NEXT);
    conflictDecision1.setType(ConflictDecision.DecisionType.CURRENT);
    result = this.diffManager
        .merge(toCharacters("aabbcc abcd"), toCharacters("ddddcc azzd"), toCharacters("arrbcc yycd"),
            mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals("ddddcc yycd", toString(result.getMerged()));
    conflictDecision.setType(ConflictDecision.DecisionType.CURRENT);
    conflictDecision1.setType(ConflictDecision.DecisionType.PREVIOUS);
    result = this.diffManager
        .merge(toCharacters("aabbcc abcd"), toCharacters("ddddcc azzd"), toCharacters("arrbcc yycd"),
            mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals("arrbcc abcd", toString(result.getMerged()));
    conflictDecision.setType(ConflictDecision.DecisionType.PREVIOUS);
    conflictDecision1.setType(ConflictDecision.DecisionType.CURRENT);
    result = this.diffManager
        .merge(toCharacters("aabbcc abcd"), toCharacters("ddddcc azzd"), toCharacters("arrbcc yycd"),
            mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals("aabbcc yycd", toString(result.getMerged()));
    conflictDecision.setType(ConflictDecision.DecisionType.NEXT);
    conflictDecision1.setType(ConflictDecision.DecisionType.PREVIOUS);
    result = this.diffManager
        .merge(toCharacters("aabbcc abcd"), toCharacters("ddddcc azzd"), toCharacters("arrbcc yycd"),
            mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals("ddddcc abcd", toString(result.getMerged()));
    conflictDecision.setType(ConflictDecision.DecisionType.PREVIOUS);
    conflictDecision1.setType(ConflictDecision.DecisionType.NEXT);
    result = this.diffManager
        .merge(toCharacters("aabbcc abcd"), toCharacters("ddddcc azzd"), toCharacters("arrbcc yycd"),
            mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals("aabbcc azzd", toString(result.getMerged()));
    conflictDecision.setType(ConflictDecision.DecisionType.UNDECIDED);
    conflictDecision1.setType(ConflictDecision.DecisionType.CURRENT);
    result = this.diffManager
        .merge(toCharacters("aabbcc abcd"), toCharacters("ddddcc azzd"), toCharacters("arrbcc yycd"),
            mergeConfiguration);
    assertEquals(1, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(1, result.getConflicts().size());
    assertEquals(conflict, result.getConflicts().get(0));
    assertEquals("arrbcc yycd", toString(result.getMerged()));
    conflictDecision.setType(ConflictDecision.DecisionType.CURRENT);
    conflictDecision1.setType(ConflictDecision.DecisionType.UNDECIDED);
    result = this.diffManager
        .merge(toCharacters("aabbcc abcd"), toCharacters("ddddcc azzd"), toCharacters("arrbcc yycd"),
            mergeConfiguration);
    assertEquals(1, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(1, result.getConflicts().size());
    assertEquals(conflict1, result.getConflicts().get(0));
    assertEquals("arrbcc yycd", toString(result.getMerged()));
    conflictDecision.setType(ConflictDecision.DecisionType.UNDECIDED);
    conflictDecision1.setType(ConflictDecision.DecisionType.PREVIOUS);
    result = this.diffManager
        .merge(toCharacters("aabbcc abcd"), toCharacters("ddddcc azzd"), toCharacters("arrbcc yycd"),
            mergeConfiguration);
    assertEquals(1, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(1, result.getConflicts().size());
    assertEquals(conflict, result.getConflicts().get(0));
    assertEquals("arrbcc abcd", toString(result.getMerged()));
    conflictDecision.setType(ConflictDecision.DecisionType.PREVIOUS);
    conflictDecision1.setType(ConflictDecision.DecisionType.UNDECIDED);
    result = this.diffManager
        .merge(toCharacters("aabbcc abcd"), toCharacters("ddddcc azzd"), toCharacters("arrbcc yycd"),
            mergeConfiguration);
    assertEquals(1, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(1, result.getConflicts().size());
    assertEquals(conflict1, result.getConflicts().get(0));
    assertEquals("aabbcc yycd", toString(result.getMerged()));
    conflictDecision.setType(ConflictDecision.DecisionType.UNDECIDED);
    conflictDecision1.setType(ConflictDecision.DecisionType.NEXT);
    result = this.diffManager
        .merge(toCharacters("aabbcc abcd"), toCharacters("ddddcc azzd"), toCharacters("arrbcc yycd"),
            mergeConfiguration);
    assertEquals(1, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(1, result.getConflicts().size());
    assertEquals(conflict, result.getConflicts().get(0));
    assertEquals("arrbcc azzd", toString(result.getMerged()));
    conflictDecision.setType(ConflictDecision.DecisionType.NEXT);
    conflictDecision1.setType(ConflictDecision.DecisionType.UNDECIDED);
    result = this.diffManager
        .merge(toCharacters("aabbcc abcd"), toCharacters("ddddcc azzd"), toCharacters("arrbcc yycd"),
            mergeConfiguration);
    assertEquals(1, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(1, result.getConflicts().size());
    assertEquals(conflict1, result.getConflicts().get(0));
    assertEquals("ddddcc yycd", toString(result.getMerged()));
    conflictDecision.setCustom(toCharacters("bla"));
    conflictDecision1.setType(ConflictDecision.DecisionType.UNDECIDED);
    result = this.diffManager
        .merge(toCharacters("aabbcc abcd"), toCharacters("ddddcc azzd"), toCharacters("arrbcc yycd"),
            mergeConfiguration);
    assertEquals(1, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(1, result.getConflicts().size());
    assertEquals(conflict1, result.getConflicts().get(0));
    assertEquals("blacc yycd", toString(result.getMerged()));
    conflictDecision.setType(ConflictDecision.DecisionType.UNDECIDED);
    conflictDecision1.setCustom(toCharacters("foo"));
    result = this.diffManager
        .merge(toCharacters("aabbcc abcd"), toCharacters("ddddcc azzd"), toCharacters("arrbcc yycd"),
            mergeConfiguration);
    assertEquals(1, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(1, result.getConflicts().size());
    assertEquals(conflict, result.getConflicts().get(0));
    assertEquals("arrbcc food", toString(result.getMerged()));
    conflictDecision.setType(ConflictDecision.DecisionType.CUSTOM);
    conflictDecision1.setType(ConflictDecision.DecisionType.NEXT);
    result = this.diffManager
        .merge(toCharacters("aabbcc abcd"), toCharacters("ddddcc azzd"), toCharacters("arrbcc yycd"),
            mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals("cc azzd", toString(result.getMerged()));
    conflictDecision.setType(ConflictDecision.DecisionType.NEXT);
    conflictDecision1.setCustom(toCharacters("foobar"));
    result = this.diffManager
        .merge(toCharacters("aabbcc abcd"), toCharacters("ddddcc azzd"), toCharacters("arrbcc yycd"),
            mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals("ddddcc foobard", toString(result.getMerged()));
    conflictDecision.setCustom(toCharacters("Something like that"));
    conflictDecision1.setType(ConflictDecision.DecisionType.PREVIOUS);
    result = this.diffManager
        .merge(toCharacters("aabbcc abcd"), toCharacters("ddddcc azzd"), toCharacters("arrbcc yycd"),
            mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals("Something like thatcc abcd", toString(result.getMerged()));
    conflictDecision.setType(ConflictDecision.DecisionType.PREVIOUS);
    conflictDecision1.setCustom(toCharacters("dddddd"));
    result = this.diffManager
        .merge(toCharacters("aabbcc abcd"), toCharacters("ddddcc azzd"), toCharacters("arrbcc yycd"),
            mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals("aabbcc ddddddd", toString(result.getMerged()));
    conflictDecision.setCustom(toCharacters("abc"));
    conflictDecision1.setType(ConflictDecision.DecisionType.CURRENT);
    result = this.diffManager
        .merge(toCharacters("aabbcc abcd"), toCharacters("ddddcc azzd"), toCharacters("arrbcc yycd"),
            mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals("abccc yycd", toString(result.getMerged()));
    conflictDecision.setType(ConflictDecision.DecisionType.CURRENT);
    conflictDecision1.setCustom(toCharacters("azzd"));
    result = this.diffManager
        .merge(toCharacters("aabbcc abcd"), toCharacters("ddddcc azzd"), toCharacters("arrbcc yycd"),
            mergeConfiguration);
    assertEquals(0, result.getLog().getLogs(LogLevel.ERROR).size());
    assertEquals(0, result.getConflicts().size());
    assertEquals("arrbcc azzdd", toString(result.getMerged()));
}