use of org.custommonkey.xmlunit.examples.RecursiveElementNameAndTextQualifier in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityEntityToModelMapperTest method testMapToFLUXFAReportMessage.
@Test
@Parameters(method = "resources")
public void testMapToFLUXFAReportMessage(String resource) throws Exception {
FLUXFAReportMessage fluxfaReportMessage = sourceToEntity(resource);
FluxFaReportMessageEntity entity = incomingFAReportMapper.mapToFluxFaReportMessage(fluxfaReportMessage, FaReportSourceEnum.MANUAL, new FluxFaReportMessageEntity());
FLUXFAReportMessage target = modelMapper.mapToFLUXFAReportMessage(new ArrayList<>(entity.getFaReportDocuments()));
String controlSource = JAXBUtils.marshallJaxBObjectToString(getFirstElement(fluxfaReportMessage));
String testSource = JAXBUtils.marshallJaxBObjectToString(getFirstElement(target));
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setIgnoreComments(true);
XMLUnit.setIgnoreAttributeOrder(true);
DetailedDiff diff = new DetailedDiff(new org.custommonkey.xmlunit.Diff(clearEmptyTags(controlSource), clearEmptyTags(testSource)));
diff.overrideElementQualifier(new RecursiveElementNameAndTextQualifier());
assertTrue("XML are similar " + diff, diff.similar());
}
use of org.custommonkey.xmlunit.examples.RecursiveElementNameAndTextQualifier in project sirix by sirixdb.
the class TestNodeWrapperS9ApiXSLT method testWithSerializer.
@Test
public void testWithSerializer() throws Exception {
final Serializer serializer = new Serializer();
serializer.setOutputProperty(Serializer.Property.METHOD, "xml");
serializer.setOutputProperty(Serializer.Property.INDENT, "yes");
final OutputStream out = new XSLTEvaluator(mHolder.getSession(), STYLESHEET, new ByteArrayOutputStream(), serializer).call();
final StringBuilder sBuilder = readFile();
final Diff diff = new Diff(sBuilder.toString(), out.toString());
diff.overrideElementQualifier(new RecursiveElementNameAndTextQualifier());
assertTrue(diff.toString(), diff.similar());
}
use of org.custommonkey.xmlunit.examples.RecursiveElementNameAndTextQualifier in project Smack by igniterealtime.
the class XmlUnitUtils method assertSimilar.
public static void assertSimilar(CharSequence expected, CharSequence actual) throws SAXException, IOException {
Diff diff = new Diff(expected.toString(), actual.toString());
diff.overrideElementQualifier(new RecursiveElementNameAndTextQualifier());
assertXMLEqual(diff, true);
}
use of org.custommonkey.xmlunit.examples.RecursiveElementNameAndTextQualifier in project pentaho-platform by pentaho.
the class CacheExpirationServiceTest method testGetXml_MultipleItems.
@Test
public void testGetXml_MultipleItems() throws SAXException, IOException {
TestCacheItem item = new TestCacheItem("pentaho_cache_itemKey1");
String lm = Long.toString(item.getLastModified());
registry.register(item);
item = new TestCacheItem("pentaho_cache_itemKey2");
String lm2 = Long.toString(item.getLastModified());
registry.register(item);
String xml = service.getXml();
Diff myDiff = new Diff("<cache-expiration-items><cache-item><key>pentaho_cache_itemKey1</key><last-modified>" + lm + "</last-modified></cache-item><cache-item><key>pentaho_cache_itemKey2</key><last-modified>" + lm2 + "</last-modified></cache-item></cache-expiration-items>", xml);
// This allows the xml elements to be ordered differently and still pass the equality check
myDiff.overrideElementQualifier(new RecursiveElementNameAndTextQualifier());
assertXMLEqual("But they are equal when an ElementQualifier controls which test element is compared with each control element", myDiff, true);
assertEquals(2, registry.getCachedItems().size());
}
use of org.custommonkey.xmlunit.examples.RecursiveElementNameAndTextQualifier in project sirix by sirixdb.
the class TestNodeWrapperS9ApiXSLT method testWithoutSerializer.
@Test
public void testWithoutSerializer() throws Exception {
final OutputStream out = new XSLTEvaluator(mHolder.getSession(), STYLESHEET, new ByteArrayOutputStream()).call();
final StringBuilder sBuilder = readFile();
final Diff diff = new Diff(sBuilder.toString(), out.toString());
diff.overrideElementQualifier(new RecursiveElementNameAndTextQualifier());
assertTrue(diff.toString(), diff.similar());
}
Aggregations