StateReport reportOld = DefaultSaxParser.parse(oldXml);
StateReport reportNew = DefaultSaxParser.parse(newXml);
String expected = Files.forIO()
.readFrom(getClass().getResourceAsStream("historyResult.xml"), "utf-8");
HistoryStateReportMerger merger = new HistoryStateReportMerger(new StateReport(reportOld.getDomain()));
reportOld.accept(merger);
reportNew.accept(merger);
Assert.assertEquals("Check the merge result!", expected.replaceAll("\r", ""), merger.getStateReport()
.toString().replaceAll("\r", ""));
Assert.assertEquals("Source report is changed!", newXml.replaceAll("\r", ""),
reportNew.toString().replaceAll("\r", ""));
Assert.assertEquals("Source report is changed!", oldXml.replaceAll("\r", ""),
reportOld.toString().replaceAll("\r", ""));