### Question:
DefaultMergeManager implements MergeManager { @Override public <T> MergeManagerResult<List<T>, T> mergeList(List<T> commonAncestor, List<T> next, List<T> current, MergeConfiguration configuration) { MergeManagerResult<List<T>, T> mergeResult = new MergeManagerResult<>(); try { org.xwiki.diff.MergeResult<T> result = this.diffManager.merge(commonAncestor, next, current, getDefaultConfiguration(configuration)); mergeResult.getLog().addAll(result.getLog()); mergeResult.addConflicts(result.getConflicts()); mergeResult.setMergeResult(result.getMerged()); mergeResult.setModified(!result.getMerged().equals(current)); } catch (MergeException e) { mergeResult.getLog().error("Failed to execute merge lists", e); } return mergeResult; }  @Override MergeManagerResult<String, String> mergeLines(String previousStr, String newStr, String currentStr,
        MergeConfiguration configuration); @Override MergeManagerResult<T, T> mergeObject(T previousObject, T newObject, T currentObject,
        MergeConfiguration configuration); @Override MergeManagerResult<String, Character> mergeCharacters(String previousStr, String newStr, String currentStr,
        MergeConfiguration configuration); @Override MergeManagerResult<List<T>, T> mergeList(List<T> commonAncestor, List<T> next, List<T> current,
        MergeConfiguration configuration); @Override MergeDocumentResult mergeDocument(DocumentModelBridge previousDocument,
        DocumentModelBridge newDocument, DocumentModelBridge currentDocument, MergeConfiguration configuration);  }### Answer:
@Test public void mergeListSimple() { List<String> current = new ArrayList<String>(Arrays.asList("old1", "old2")); MergeManagerResult<List<String>, String> result = mergeManager.mergeList(Arrays.asList("old1", "old2"), Arrays.asList("new1", "new2"), current, new MergeConfiguration()); assertEquals(Arrays.asList("new1", "new2"), result.getMergeResult()); assertTrue(result.isModified()); assertFalse(result.hasConflicts()); }
@Test public void mergeListAlreadyDone() { List<String> current = new ArrayList<String>(Arrays.asList("new1", "new2")); MergeManagerResult<List<String>, String> result = mergeManager.mergeList(Arrays.asList("old1", "old2"), Arrays.asList("new1", "new2"), current, new MergeConfiguration()); assertEquals(Arrays.asList("new1", "new2"), result.getMergeResult()); assertEquals(Arrays.asList("new1", "new2"), current); assertFalse(result.isModified()); assertFalse(result.hasConflicts()); }
@Test public void mergeListWhileModified() { List<String> current = new ArrayList<String>(Arrays.asList("new1", "old modified2")); MergeManagerResult<List<String>, String> result = mergeManager.mergeList(Arrays.asList("new1", "old2"), Arrays.asList("new1", "new2"), current, new MergeConfiguration()); assertEquals(Arrays.asList("new1", "old modified2"), result.getMergeResult()); assertFalse(result.isModified()); assertFalse(result.getLog().getLogs(LogLevel.ERROR).isEmpty()); assertTrue(result.hasConflicts()); ConflictDecision<String> conflictDecision = new DefaultConflictDecision<>(result.getConflicts().get(0)); conflictDecision.setCustom(Arrays.asList("Foo", "Bar", "Thing")); this.conflictDecisionList.add(conflictDecision); MergeConfiguration mergeConfiguration = new MergeConfiguration(); mergeConfiguration.setUserReference(this.userReference); mergeConfiguration.setConcernedDocument(this.documentReference); result = mergeManager.mergeList(Arrays.asList("new1", "old2"), Arrays.asList("new1", "new2"), current, mergeConfiguration); assertEquals(Arrays.asList("new1", "old modified2"), current); assertEquals(Arrays.asList("new1", "Foo", "Bar", "Thing"), result.getMergeResult()); assertTrue(result.isModified()); assertTrue(result.getLog().getLogs(LogLevel.ERROR).isEmpty()); assertFalse(result.hasConflicts()); }