Class ValueAssert

  • All Implemented Interfaces:
    org.assertj.core.api.Assert<ValueAssert,​java.lang.String>, org.assertj.core.api.Descriptable<ValueAssert>, org.assertj.core.api.EnumerableAssert<ValueAssert,​java.lang.Character>, org.assertj.core.api.ExtensionPoints<ValueAssert,​java.lang.String>

    public class ValueAssert
    extends org.assertj.core.api.AbstractCharSequenceAssert<ValueAssert,​java.lang.String>
    Assertion methods for String result of XPath evaluation.

    Simple Example

     import static org.xmlunit.assertj.XmlAssert.assertThat;
    
     final String xml = "<a><b attr=\"abc\"></b></a>";
    
     assertThat(xml).valueByXPath("count(//a/b)").isEqualTo(3);
     
    Since:
    XMLUnit 2.6.1
    • Field Summary

      • Fields inherited from class org.assertj.core.api.AbstractAssert

        actual, info, myself, objects, throwUnsupportedExceptionOnEquals
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ValueAssert​(java.lang.String value)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.assertj.core.api.AbstractBooleanAssert<?> asBoolean()
      Returns an Assert object that allows performing assertions on boolean value of the String under test.
      org.assertj.core.api.AbstractDoubleAssert<?> asDouble()
      Returns an Assert object that allows performing assertions on integer value of the String under test.
      org.assertj.core.api.AbstractIntegerAssert<?> asInt()
      Returns an Assert object that allows performing assertions on integer value of the String under test.
      XmlAssert asXml()
      Returns an XmlAssert object that allows performing assertions on XML value of the String under test.
      (package private) static ValueAssert create​(java.lang.Object xmlSource, java.util.Map<java.lang.String,​java.lang.String> prefix2Uri, javax.xml.parsers.DocumentBuilderFactory dbf, javax.xml.xpath.XPathFactory xpf, java.lang.String xPath)  
      ValueAssert isEqualTo​(boolean expected)
      Try convert the String under test to boolean using asBoolean() and compare with given value.
      ValueAssert isEqualTo​(double expected)
      Try convert the String under test to double using asDouble() and compare with given value.
      ValueAssert isEqualTo​(int expected)
      Try convert the String under test to int using asInt() and compare with given value.
      • Methods inherited from class org.assertj.core.api.AbstractCharSequenceAssert

        contains, contains, containsIgnoringCase, containsOnlyDigits, containsOnlyOnce, containsOnlyWhitespaces, containsPattern, containsPattern, containsSequence, containsSequence, containsSubsequence, containsSubsequence, containsWhitespaces, doesNotContain, doesNotContain, doesNotContainAnyWhitespaces, doesNotContainOnlyWhitespaces, doesNotContainPattern, doesNotContainPattern, doesNotEndWith, doesNotMatch, doesNotMatch, doesNotStartWith, endsWith, hasLineCount, hasSameSizeAs, hasSameSizeAs, hasSameSizeAs, hasSize, hasSizeBetween, hasSizeGreaterThan, hasSizeGreaterThanOrEqualTo, hasSizeLessThan, hasSizeLessThanOrEqualTo, inHexadecimal, inUnicode, isBlank, isEmpty, isEqualToIgnoringCase, isEqualToIgnoringNewLines, isEqualToIgnoringWhitespace, isEqualToNormalizingNewlines, isEqualToNormalizingWhitespace, isJavaBlank, isLowerCase, isNotBlank, isNotEmpty, isNotEqualToIgnoringCase, isNotEqualToIgnoringWhitespace, isNotEqualToNormalizingWhitespace, isNotJavaBlank, isNullOrEmpty, isSubstringOf, isUpperCase, isXmlEqualTo, isXmlEqualToContentOf, matches, matches, startsWith, usingComparator, usingComparator, usingDefaultComparator, usingDefaultElementComparator, usingElementComparator
      • Methods inherited from class org.assertj.core.api.AbstractAssert

        as, as, asInstanceOf, asList, asString, describedAs, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, equals, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, inBinary, is, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, matches, matches, newListAssertInstance, overridingErrorMessage, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, setCustomRepresentation, throwAssertionError, withFailMessage, withRepresentation, withThreadDumpOnError
      • Methods inherited from class java.lang.Object

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

      • ValueAssert

        private ValueAssert​(java.lang.String value)
    • Method Detail

      • create

        static ValueAssert create​(java.lang.Object xmlSource,
                                  java.util.Map<java.lang.String,​java.lang.String> prefix2Uri,
                                  javax.xml.parsers.DocumentBuilderFactory dbf,
                                  javax.xml.xpath.XPathFactory xpf,
                                  java.lang.String xPath)
      • asInt

        public org.assertj.core.api.AbstractIntegerAssert<?> asInt()
        Returns an Assert object that allows performing assertions on integer value of the String under test.
        Throws:
        java.lang.AssertionError - if the actual value is null.
        java.lang.AssertionError - if the actual value does not contain a parsable integer
      • asDouble

        public org.assertj.core.api.AbstractDoubleAssert<?> asDouble()
        Returns an Assert object that allows performing assertions on integer value of the String under test.
        Throws:
        java.lang.AssertionError - if the actual value is null.
        java.lang.AssertionError - if the actual value does not contain a parsable double
      • asBoolean

        public org.assertj.core.api.AbstractBooleanAssert<?> asBoolean()
        Returns an Assert object that allows performing assertions on boolean value of the String under test.

        If actual value after lowercasing is one of the following "true", "false", then it can be parsed to boolean.

        Throws:
        java.lang.AssertionError - if the actual value is null.
        java.lang.AssertionError - if the actual value does not contain a parsable boolean
      • asXml

        public XmlAssert asXml()
        Returns an XmlAssert object that allows performing assertions on XML value of the String under test.
        Throws:
        java.lang.AssertionError - if the actual value is null.
      • isEqualTo

        public ValueAssert isEqualTo​(int expected)
        Try convert the String under test to int using asInt() and compare with given value.
      • isEqualTo

        public ValueAssert isEqualTo​(double expected)
        Try convert the String under test to double using asDouble() and compare with given value.
      • isEqualTo

        public ValueAssert isEqualTo​(boolean expected)
        Try convert the String under test to boolean using asBoolean() and compare with given value.