Package org.xmlunit.assertj
Class ValueAssert
java.lang.Object
org.assertj.core.api.AbstractAssert<SELF,ACTUAL>
org.assertj.core.api.AbstractCharSequenceAssert<ValueAssert,String>
org.xmlunit.assertj.ValueAssert
- All Implemented Interfaces:
org.assertj.core.api.Assert<ValueAssert,
,String> org.assertj.core.api.Descriptable<ValueAssert>
,org.assertj.core.api.EnumerableAssert<ValueAssert,
,Character> org.assertj.core.api.ExtensionPoints<ValueAssert,
String>
public class ValueAssert
extends org.assertj.core.api.AbstractCharSequenceAssert<ValueAssert,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
-
Method Summary
Modifier and TypeMethodDescriptionorg.assertj.core.api.AbstractBooleanAssert<?>
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.asXml()
Returns anXmlAssert
object that allows performing assertions on XML value of theString
under test.Returns anXmlAssert
object that allows performing assertions on XML value of theString
under test wrapping around tag with name given in wrapNodeName.describedAs
(String description, Object... args) isEqualTo
(boolean expected) Try convert theString
under test to boolean usingasBoolean()
and compare with given value.isEqualTo
(double expected) Try convert theString
under test to double usingasDouble()
and compare with given value.isEqualTo
(int expected) 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, 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, usingElementComparator
Methods inherited from class org.assertj.core.api.AbstractAssert
asInstanceOf, 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, withThreadDumpOnError
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.assertj.core.api.Descriptable
as, as
-
Method Details
-
asInt
public org.assertj.core.api.AbstractIntegerAssert<?> asInt()Returns anAssert
object that allows performing assertions on integer value of theString
under test.- Returns:
- an
Assert
object for integer assertions - Throws:
AssertionError
- if the actual value isnull
.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.- Returns:
- an
Assert
object for double assertions - Throws:
AssertionError
- if the actual value isnull
.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.
- Returns:
- an
Assert
object for boolean assertions - Throws:
AssertionError
- if the actual value isnull
.AssertionError
- if the actual value does not contain a parsable boolean
-
asXml
Returns anXmlAssert
object that allows performing assertions on XML value of theString
under test.- Returns:
- an
Assert
object for XML assertions - Throws:
AssertionError
- if the actual value isnull
.
-
asXml
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);
- Parameters:
wrapNodeName
- name of the element to wrap around the string under test- Returns:
- an
Assert
object for XML assertions - Throws:
AssertionError
- if the actual value isnull
.- Since:
- XMLUnit 2.6.4
-
isEqualTo
- Parameters:
expected
- expected value- Returns:
- this
-
isEqualTo
Try convert theString
under test to double usingasDouble()
and compare with given value.- Parameters:
expected
- expected value- Returns:
- this
-
isEqualTo
Try convert theString
under test to boolean usingasBoolean()
and compare with given value.- Parameters:
expected
- expected value- Returns:
- this
-
describedAs
-