Class XmlTestSupport


  • public abstract class XmlTestSupport
    extends Object
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  XmlTestSupport.Namespace
      Simple tuple for holding a namespace.
    • Constructor Summary

      Constructors 
      Constructor Description
      XmlTestSupport()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected Diff diffSimilar​(Object expected, Object actual)  
      protected Map<String,​String> getNamespaces()
      Get the namespaces needed for this test class.
      protected EvaluateXPathMatcher hasXPath​(String xPath, Matcher<String> valueMatcher)
      Simply a wrapper around EvaluateXPathMatcher.hasXPath(String, Matcher) that sets the namespaces here, so that by omitting them from the assertions used in the tests, those assertions are more compact and hopefully more readable.
      static XmlTestSupport.Namespace Namespace​(String prefix, String uri)
      Construct a Namespace.
      static Map<String,​String> namespaces​(XmlTestSupport.Namespace... namespaces)
      Construct a Map of Namespace(s).
      • Methods inherited from class Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • XmlTestSupport

        public XmlTestSupport()
    • Method Detail

      • getNamespaces

        protected Map<String,​String> getNamespaces()
        Get the namespaces needed for this test class.
        Returns:
        the namespaces needed for this test class.
      • Namespace

        public static XmlTestSupport.Namespace Namespace​(String prefix,
                                                         String uri)
        Construct a Namespace. Just a shortcut for new Namespace(String, String).
        Parameters:
        prefix - the namespace prefix.
        uri - the namespace URI.
        Returns:
        the Namespace.
      • namespaces

        public static Map<String,​String> namespaces​(XmlTestSupport.Namespace... namespaces)
        Construct a Map of Namespace(s).
        Parameters:
        namespaces - the namespaces.
        Returns:
        a namespaces map.
      • hasXPath

        protected EvaluateXPathMatcher hasXPath​(String xPath,
                                                Matcher<String> valueMatcher)
        Simply a wrapper around EvaluateXPathMatcher.hasXPath(String, Matcher) that sets the namespaces here, so that by omitting them from the assertions used in the tests, those assertions are more compact and hopefully more readable.
        Parameters:
        xPath - the xpath to evaluate
        valueMatcher - the result of the xpath evaluation to match
        Returns:
        an XPath Matcher
      • diffSimilar

        protected Diff diffSimilar​(Object expected,
                                   Object actual)