Package org.xmlunit.assertj
Class ValueAssert
- java.lang.Object
-
- org.assertj.core.api.AbstractAssert<SELF,ACTUAL>
-
- org.assertj.core.api.AbstractCharSequenceAssert<ValueAssert,java.lang.String>
-
- org.xmlunit.assertj.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 forString
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
-
-
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 anAssert
object that allows performing assertions on boolean value of theString
under test.org.assertj.core.api.AbstractDoubleAssert<?>
asDouble()
Returns anAssert
object that allows performing assertions on integer value of theString
under test.org.assertj.core.api.AbstractIntegerAssert<?>
asInt()
Returns anAssert
object that allows performing assertions on integer value of theString
under test.XmlAssert
asXml()
Returns anXmlAssert
object that allows performing assertions on XML value of theString
under test.XmlAssert
asXml(java.lang.String wrapNodeName)
Returns anXmlAssert
object that allows performing assertions on XML value of theString
under test wrapping around tag with name given in wrapNodeName.(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
describedAs(java.lang.String description, java.lang.Object... args)
ValueAssert
isEqualTo(boolean expected)
Try convert theString
under test to boolean usingasBoolean()
and compare with given value.ValueAssert
isEqualTo(double expected)
Try convert theString
under test to double usingasDouble()
and compare with given value.ValueAssert
isEqualTo(int expected)
Try convert theString
under test to int usingasInt()
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, isEqualToNormalizingPunctuationAndWhitespace, 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
asInstanceOf, asList, assertionError, asString, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, equals, extracting, extracting, failWithActualExpectedAndMessage, 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, satisfiesAnyOf, setCustomRepresentation, throwAssertionError, usingRecursiveComparison, usingRecursiveComparison, withFailMessage, withRepresentation, withThreadDumpOnError
-
-
-
-
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 anAssert
object that allows performing assertions on integer value of theString
under test.- Throws:
java.lang.AssertionError
- if the actual value isnull
.java.lang.AssertionError
- if the actual value does not contain a parsable integer
-
asDouble
public org.assertj.core.api.AbstractDoubleAssert<?> asDouble()
Returns anAssert
object that allows performing assertions on integer value of theString
under test.- Throws:
java.lang.AssertionError
- if the actual value isnull
.java.lang.AssertionError
- if the actual value does not contain a parsable double
-
asBoolean
public org.assertj.core.api.AbstractBooleanAssert<?> asBoolean()
Returns anAssert
object that allows performing assertions on boolean value of theString
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 isnull
.java.lang.AssertionError
- if the actual value does not contain a parsable boolean
-
asXml
public XmlAssert asXml()
Returns anXmlAssert
object that allows performing assertions on XML value of theString
under test.- Throws:
java.lang.AssertionError
- if the actual value isnull
.
-
asXml
public XmlAssert asXml(java.lang.String wrapNodeName)
Returns anXmlAssert
object that allows performing assertions on XML value of theString
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);
- Throws:
java.lang.AssertionError
- if the actual value isnull
.- Since:
- XMLUnit 2.6.4
-
isEqualTo
public ValueAssert isEqualTo(int expected)
Try convert theString
under test to int usingasInt()
and compare with given value.
-
isEqualTo
public ValueAssert isEqualTo(double expected)
Try convert theString
under test to double usingasDouble()
and compare with given value.
-
isEqualTo
public ValueAssert isEqualTo(boolean expected)
Try convert theString
under test to boolean usingasBoolean()
and compare with given value.
-
describedAs
public ValueAssert describedAs(java.lang.String description, java.lang.Object... args)
-
-