Package org.opengis.cite.cat20.dgiwg10
Class ETSAssert
java.lang.Object
org.opengis.cite.cat20.dgiwg10.ETSAssert
Provides a set of custom assertion methods.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
assertQualifiedName
(Document document, String namespaceUri, String localName) Asserts that the qualified name of a Document root node matches the expected value.static void
assertQualifiedName
(Node node, String namespaceUri, String localName) Asserts that the qualified name of a DOM Node matches the expected value.static void
assertSchemaValid
(Validator validator, Source source) Asserts that an XML resource is schema-valid.static void
assertStatusCode
(int statusCode, int expectedStatusCode) Asserts that the status code matches the expected status code.static void
assertTrue
(boolean valueToAssert, String failureMsg) static void
assertXmlContentType
(jakarta.ws.rs.core.MultivaluedMap<String, Object> headers) Asserts that the header "Content-Type" contains a value with 'xml'.static void
assertXPath
(Node context, String expr) Asserts that an XPath 1.0 expression holds true for the given evaluation context.static void
Asserts that an XPath 1.0 expression holds true for the given evaluation context.static void
assertXPath
(Node context, String expr, Map<String, String> namespaceBindings, String assertionErrorMessage) Asserts that an XPath 1.0 expression holds true for the given evaluation context.
-
Method Details
-
assertStatusCode
public static void assertStatusCode(int statusCode, int expectedStatusCode) Asserts that the status code matches the expected status code.- Parameters:
statusCode
- the status codeexpectedStatusCode
- the expected status code
-
assertXmlContentType
Asserts that the header "Content-Type" contains a value with 'xml'.- Parameters:
headers
- the available headers
-
assertTrue
- Parameters:
valueToAssert
- the boolean to assert to betrue
failureMsg
- the message to throw in case of a failure, should not benull
-
assertQualifiedName
Asserts that the qualified name of a Document root node matches the expected value.- Parameters:
document
- The document to check the root node.namespaceUri
- the expected namespace uri.localName
- the expected local name.
-
assertQualifiedName
Asserts that the qualified name of a DOM Node matches the expected value.- Parameters:
node
- The Node to check.namespaceUri
- the expected namespace uri.localName
- the expected local name.
-
assertXPath
Asserts that an XPath 1.0 expression holds true for the given evaluation context. The standard namespace bindings from NamespaceBindings.withStandardBindings() are used.- Parameters:
context
- The context node.expr
- A valid XPath 1.0 expression.
-
assertXPath
Asserts that an XPath 1.0 expression holds true for the given evaluation context. The standard namespace bindings from NamespaceBindings.withStandardBindings() must not be declared.- Parameters:
context
- The context node.expr
- A valid XPath 1.0 expression.namespaceBindings
- A collection of namespace bindings for the XPath expression, where each entry maps a namespace URI (key) to a prefix (value). It may benull
.
-
assertXPath
public static void assertXPath(Node context, String expr, Map<String, String> namespaceBindings, String assertionErrorMessage) Asserts that an XPath 1.0 expression holds true for the given evaluation context. The standard namespace bindings from NamespaceBindings.withStandardBindings() must not be declared.- Parameters:
context
- The context node.expr
- A valid XPath 1.0 expression.namespaceBindings
- A collection of namespace bindings for the XPath expression, where each entry maps a namespace URI (key) to a prefix (value). It may benull
.assertionErrorMessage
- message to throw if assertion failed, should not benull
-
assertSchemaValid
Asserts that an XML resource is schema-valid.- Parameters:
validator
- The Validator to use.source
- The XML Source to be validated.
-