Class XmlSnapshot

  • All Implemented Interfaces:
    StructuredDataProvider

    @API(status=STABLE)
    public final class XmlSnapshot
    extends Object
    implements StructuredDataProvider
    StructuredData builder for serializing test results to XML, relying on JAXB and XML-Unit.

    You can either use a pre-configured default instance via xml or use any of the static factory methods to customize the construction.

    Author:
    Simon Taddiken
    • Method Detail

      • inferJaxbContext

        public static XmlSnapshot inferJaxbContext()
        Tries to infer the JAXBContext from the passed in actual test result.
        Returns:
        A builder for building StructuredData.
      • with

        public static XmlSnapshot with​(javax.xml.bind.JAXBContext jaxbContext)
        Uses the given JAXBContext as entry point for serializing snapshots.
        Parameters:
        jaxbContext - The JAXBContext to use.
        Returns:
        A builder for building StructuredData.
      • withMarshaller

        public XmlSnapshot withMarshaller​(de.skuzzle.test.snapshots.data.xml.XmlSnapshot.MarshallerSupplier marshallerSupplier)
        Supplies the Marshaller which will be used to serialize the snapshot to xml.
        Parameters:
        marshallerSupplier - The supplier.
        Returns:
        This builder instance.
      • compareUsing

        @API(status=EXPERIMENTAL)
        public XmlSnapshot compareUsing​(Consumer<org.xmlunit.assertj.CompareAssert> xmls)
        Defines which Xml-Assert assertion method will actually be used. Defaults to CompareAssert.areIdentical().
        Parameters:
        xmls - Consumes the CompareAssert which compares the actual and expected xml.
        Returns:
        This builder instance.