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, doesNotContain, doesNotContain, doesNotContainOnlyWhitespaces, doesNotContainPattern, doesNotContainPattern, doesNotEndWith, doesNotMatch, doesNotMatch, doesNotStartWith, endsWith, hasLineCount, hasSameSizeAs, hasSameSizeAs, hasSameSizeAs, hasSize, inHexadecimal, inUnicode, isBlank, isEmpty, isEqualToIgnoringCase, isEqualToIgnoringNewLines, isEqualToIgnoringWhitespace, isEqualToNormalizingNewlines, isEqualToNormalizingWhitespace, isJavaBlank, isNotBlank, isNotEmpty, isNotEqualToIgnoringCase, isNotEqualToIgnoringWhitespace, isNotEqualToNormalizingWhitespace, isNotJavaBlank, isNullOrEmpty, isSubstringOf, isXmlEqualTo, isXmlEqualToContentOf, matches, matches, startsWith, usingComparator, usingDefaultComparator, usingDefaultElementComparator, usingElementComparator
as, as, asList, asString, describedAs, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, equals, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, inBinary, is, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, overridingErrorMessage, setCustomRepresentation, throwAssertionError, withFailMessage, withRepresentation, withThreadDumpOnError
public org.assertj.core.api.AbstractIntegerAssert<?> asInt()
Assert
object that allows performing assertions on integer value of the String
under test.AssertionError
- 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.AssertionError
- 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.
AssertionError
- 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.AssertionError
- 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);
AssertionError
- if the actual value is null
.public ValueAssert isEqualTo(int expected)
public ValueAssert isEqualTo(double expected)
String
under test to double using asDouble()
and compare with given value.public ValueAssert isEqualTo(boolean expected)
String
under test to boolean using asBoolean()
and compare with given value.Copyright © 2001–2020 XMLUnit. All rights reserved.