Package org.xmlunit.assertj
Class SingleNodeAssert
- java.lang.Object
-
- org.assertj.core.api.AbstractAssert<SingleNodeAssert,org.w3c.dom.Node>
-
- org.xmlunit.assertj.SingleNodeAssert
-
- All Implemented Interfaces:
org.assertj.core.api.Assert<SingleNodeAssert,org.w3c.dom.Node>
,org.assertj.core.api.Descriptable<SingleNodeAssert>
,org.assertj.core.api.ExtensionPoints<SingleNodeAssert,org.w3c.dom.Node>
public class SingleNodeAssert extends org.assertj.core.api.AbstractAssert<SingleNodeAssert,org.w3c.dom.Node>
Assertion methods forNode
.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").
- Since:
- XMLUnit 2.6.1
-
-
Constructor Summary
Constructors Constructor Description SingleNodeAssert(org.w3c.dom.Node node)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.util.Map.Entry<javax.xml.namespace.QName,java.lang.String>
attributeForName(java.lang.String attributeName)
SingleNodeAssert
doesNotHaveAttribute(java.lang.String attributeName)
Verifies that node has not attribute with given name.SingleNodeAssert
doesNotHaveAttribute(java.lang.String attributeName, java.lang.String attributeValue)
Verifies that node has not attribute with given name and value.SingleNodeAssert
hasAttribute(java.lang.String attributeName)
Verifies that node has attribute with given name.SingleNodeAssert
hasAttribute(java.lang.String attributeName, java.lang.String attributeValue)
Verifies that node has attribute with given name and value.private static boolean
matchQName(javax.xml.namespace.QName qName, java.lang.String name)
-
Methods inherited from class org.assertj.core.api.AbstractAssert
as, as, asInstanceOf, asList, asString, describedAs, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, equals, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, inBinary, inHexadecimal, 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, setCustomRepresentation, throwAssertionError, usingComparator, usingComparator, usingDefaultComparator, withFailMessage, withRepresentation, withThreadDumpOnError
-
-
-
-
Method Detail
-
hasAttribute
public SingleNodeAssert hasAttribute(java.lang.String attributeName)
Verifies that node has attribute with given name.- Throws:
java.lang.AssertionError
- if the actual node isnull
.java.lang.AssertionError
- if node has not attribute with given name.
-
hasAttribute
public SingleNodeAssert hasAttribute(java.lang.String attributeName, java.lang.String attributeValue)
Verifies that node has attribute with given name and value.- Throws:
java.lang.AssertionError
- if the actual node isnull
.java.lang.AssertionError
- if node has not attribute with given name and value.
-
doesNotHaveAttribute
public SingleNodeAssert doesNotHaveAttribute(java.lang.String attributeName)
Verifies that node has not attribute with given name.- Throws:
java.lang.AssertionError
- if the actual node isnull
.java.lang.AssertionError
- if node has attribute with given name.
-
doesNotHaveAttribute
public SingleNodeAssert doesNotHaveAttribute(java.lang.String attributeName, java.lang.String attributeValue)
Verifies that node has not attribute with given name and value.- Throws:
java.lang.AssertionError
- if the actual node isnull
.java.lang.AssertionError
- if node has attribute with given name and value.
-
attributeForName
private java.util.Map.Entry<javax.xml.namespace.QName,java.lang.String> attributeForName(java.lang.String attributeName)
-
matchQName
private static boolean matchQName(javax.xml.namespace.QName qName, java.lang.String name)
-
-