use of com.xpn.xwiki.doc.merge.MergeResult in project xwiki-platform by xwiki.
the class BaseObjectTest method testMerge.
@Test
public void testMerge() {
BaseObject previousObject = new BaseObject();
previousObject.setStringValue("str", "value");
BaseObject nextObject = new BaseObject();
nextObject.setStringValue("str", "newvalue");
BaseObject currentObject = new BaseObject();
currentObject.setStringValue("str", "value");
MergeConfiguration mergeConfiguration = new MergeConfiguration();
MergeResult mergeResult = new MergeResult();
currentObject.merge(previousObject, nextObject, mergeConfiguration, this.oldcore.getXWikiContext(), mergeResult);
List<LogEvent> errors = mergeResult.getLog().getLogsFrom(LogLevel.WARN);
if (errors.size() > 0) {
Assert.fail("Found error or warning during the merge (" + errors.get(0) + ")");
}
Assert.assertEquals("newvalue", currentObject.getStringValue("str"));
}
Aggregations