public class SingleNodeAssert extends org.assertj.core.api.AbstractAssert<SingleNodeAssert,Node>
Node
.
Simple Example
import static org.xmlunit.assertj.XmlAssert.assertThat; final String xml = "<a><b attr=\"abc\"></b></a>"; assertThat(xml).nodesByXPath("//a/b").first().hasAttribute("attr", "abc").
Modifier and Type | Method and Description |
---|---|
SingleNodeAssert |
doesNotHaveAttribute(String attributeName)
Verifies that the actual node has not attribute with given name.
|
SingleNodeAssert |
doesNotHaveAttribute(String attributeName,
String attributeValue)
Verifies that the actual node has not attribute with given name and value.
|
SingleNodeAssert |
hasAttribute(String attributeName)
Verifies that the actual node has attribute with given name.
|
SingleNodeAssert |
hasAttribute(String attributeName,
String attributeValue)
Verifies that the actual node has attribute with given name and value.
|
SingleNodeAssert |
hasXPath(String xPath)
Verifies that the actual node or any child node matches given
xPath . |
as, as, asList, asString, describedAs, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, equals, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, inBinary, inHexadecimal, is, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, overridingErrorMessage, setCustomRepresentation, throwAssertionError, usingComparator, usingDefaultComparator, withFailMessage, withRepresentation, withThreadDumpOnError
public SingleNodeAssert hasAttribute(String attributeName)
AssertionError
- if the actual node is null
.AssertionError
- if node has not attribute with given name.public SingleNodeAssert hasAttribute(String attributeName, String attributeValue)
AssertionError
- if the actual node is null
.AssertionError
- if node has not attribute with given name and value.public SingleNodeAssert doesNotHaveAttribute(String attributeName)
AssertionError
- if the actual node is null
.AssertionError
- if node has attribute with given name.public SingleNodeAssert doesNotHaveAttribute(String attributeName, String attributeValue)
AssertionError
- if the actual node is null
.AssertionError
- if node has attribute with given name and value.public SingleNodeAssert hasXPath(String xPath)
xPath
.
The actual node is the root for xPath
.AssertionError
- if the actual node is null
.AssertionError
- if node has attribute with given name and value.Copyright © 2001–2020 XMLUnit. All rights reserved.