public class ValueAssert extends org.assertj.core.api.AbstractCharSequenceAssert<ValueAssert,String>
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);
| Modifier and Type | Method and 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. |
XmlAssert |
asXml(String wrapNodeName)
Returns an
XmlAssert object that allows performing assertions on XML value of the String under test
wrapping around tag with name given in wrapNodeName. |
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)
|
contains, contains, containsIgnoringCase, containsOnlyDigits, containsOnlyOnce, containsOnlyWhitespaces, containsPattern, containsPattern, containsSequence, containsSequence, containsSubsequence, containsSubsequence, containsWhitespaces, doesNotContain, doesNotContain, doesNotContainAnyWhitespaces, doesNotContainIgnoringCase, 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, isEqualToNormalizingPunctuationAndWhitespace, isEqualToNormalizingWhitespace, isJavaBlank, isLowerCase, isNotBlank, isNotEmpty, isNotEqualToIgnoringCase, isNotEqualToIgnoringWhitespace, isNotEqualToNormalizingWhitespace, isNotJavaBlank, isNullOrEmpty, isSubstringOf, isUpperCase, isXmlEqualTo, isXmlEqualToContentOf, matches, matches, startsWith, usingComparator, usingComparator, usingDefaultComparator, usingDefaultElementComparator, usingElementComparatorasInstanceOf, asList, assertionError, asString, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, equals, extracting, extracting, failure, failureWithActualExpected, failWithActualExpectedAndMessage, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, inBinary, is, isElementOfCustomAssert, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, matches, matches, newListAssertInstance, overridingErrorMessage, overridingErrorMessage, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, satisfiesAnyOf, setCustomRepresentation, setDescriptionConsumer, setPrintAssertionsDescription, throwAssertionError, usingRecursiveComparison, usingRecursiveComparison, withFailMessage, withFailMessage, withRepresentation, withThreadDumpOnErrorpublic org.assertj.core.api.AbstractIntegerAssert<?> asInt()
Assert object that allows performing assertions on integer value of the String under test.Assert object for integer assertionsAssertionError - if the actual value is null.AssertionError - if the actual value does not contain a parsable integerpublic org.assertj.core.api.AbstractDoubleAssert<?> asDouble()
Assert object that allows performing assertions on integer value of the String under test.Assert object for double assertionsAssertionError - if the actual value is null.AssertionError - if the actual value does not contain a parsable doublepublic org.assertj.core.api.AbstractBooleanAssert<?> asBoolean()
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.
Assert object for boolean assertionsAssertionError - if the actual value is null.AssertionError - if the actual value does not contain a parsable booleanpublic XmlAssert asXml()
XmlAssert object that allows performing assertions on XML value of the String under test.Assert object for XML assertionsAssertionError - if the actual value is null.public XmlAssert asXml(String wrapNodeName)
XmlAssert object that allows performing assertions on XML value of the String under test
wrapping around tag with name given in wrapNodeName.
If wrapNodeName is null or empty then wrapping is not applied.
Pseudocode:
// given wrapNodeName = "ul"; actual = "%lt;li>a</li><li></li>"; // then xml = "<ul><li>a</li><li></li></ul>"; return XmlAssert.assertThat(xml);
wrapNodeName - name of the element to wrap around the string under testAssert object for XML assertionsAssertionError - if the actual value is null.public ValueAssert isEqualTo(int expected)
expected - expected valuepublic ValueAssert isEqualTo(double expected)
String under test to double using asDouble() and compare with given value.expected - expected valuepublic ValueAssert isEqualTo(boolean expected)
String under test to boolean using asBoolean() and compare with given value.expected - expected valueCopyright © 2001–2025 XMLUnit. All rights reserved.