Package org.xmlunit.assertj3
Class ValueAssert
java.lang.Object
org.assertj.core.api.AbstractAssert<SELF,ACTUAL>
org.assertj.core.api.AbstractCharSequenceAssert<ValueAssert,String>
org.xmlunit.assertj3.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.8.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 anAssertobject that allows performing assertions on boolean value of theStringunder test.org.assertj.core.api.AbstractDoubleAssert<?>asDouble()Returns anAssertobject that allows performing assertions on integer value of theStringunder test.org.assertj.core.api.AbstractIntegerAssert<?>asInt()Returns anAssertobject that allows performing assertions on integer value of theStringunder test.asXml()Returns anXmlAssertobject that allows performing assertions on XML value of theStringunder test.Returns anXmlAssertobject that allows performing assertions on XML value of theStringunder test wrapping around tag with name given in wrapNodeName.isEqualTo(boolean expected) Try convert theStringunder test to boolean usingasBoolean()and compare with given value.isEqualTo(double expected) Try convert theStringunder 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, usingElementComparatorMethods 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, withThreadDumpOnErrorMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.assertj.core.api.Descriptable
as, as, describedAs
-
Method Details
-
asInt
public org.assertj.core.api.AbstractIntegerAssert<?> asInt()Returns anAssertobject that allows performing assertions on integer value of theStringunder test.- Returns:
- an
Assertobject 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 anAssertobject that allows performing assertions on integer value of theStringunder test.- Returns:
- an
Assertobject 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 anAssertobject that allows performing assertions on boolean value of theStringunder test.If actual value after lowercasing is one of the following "true", "false", then it can be parsed to boolean.
- Returns:
- an
Assertobject for boolean assertions - Throws:
AssertionError- if the actual value isnull.AssertionError- if the actual value does not contain a parsable boolean
-
asXml
Returns anXmlAssertobject that allows performing assertions on XML value of theStringunder test.- Returns:
- an
Assertobject for XML assertions - Throws:
AssertionError- if the actual value isnull.
-
asXml
Returns anXmlAssertobject that allows performing assertions on XML value of theStringunder 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
Assertobject 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 theStringunder test to double usingasDouble()and compare with given value.- Parameters:
expected- expected value- Returns:
- this
-
isEqualTo
Try convert theStringunder test to boolean usingasBoolean()and compare with given value.- Parameters:
expected- expected value- Returns:
- this
-