public class ETSAssert extends Object
Modifier and Type | Method and Description |
---|---|
static void |
assertDescendantElementCount(Document xmlEntity,
QName elementName,
int expectedCount)
Asserts that the given XML entity contains the expected number of
descendant elements having the specified name.
|
static void |
assertFeatureAvailability(String id,
boolean isAvailable,
WFSClient wfsClient)
Asserts the availability of a feature having the specified resource
identifier.
|
static void |
assertFeatureProperties(String gmlId,
Map<String,Object> properties,
Map<String,String> nsBindings,
WFSClient wfsClient)
Asserts that selected properties of a feature have expected values.
|
static void |
assertQualifiedName(Node node,
QName qName)
Asserts that the qualified name of a DOM Node matches the expected value.
|
static void |
assertSchematronValid(URL schemaRef,
Source xmlSource)
Asserts that an XML resource satisfies all applicable constraints
specified in a Schematron (ISO 19757-3) schema.
|
static void |
assertSchemaValid(Validator validator,
Source source)
Asserts that an XML resource is schema-valid.
|
static void |
assertStatusCode(int actualCode,
int[] expectedCodes)
Asserts that the actual HTTP status code matches one of the expected
status codes.
|
static void |
assertXPath(String expr,
Node context,
Map<String,String> namespaceBindings)
Asserts that an XPath 1.0 expression holds true for the given evaluation
context.
|
static void |
assertXPath2(String expr,
Source source,
Map<String,String> namespaceBindings)
Asserts that an XPath 2.0 expression evaluates to
true for the
given XML source. |
public static void assertQualifiedName(Node node, QName qName)
node
- The Node to check.qName
- A QName object containing a namespace name (URI) and a local
part.public static void assertXPath(String expr, Node context, Map<String,String> namespaceBindings)
expr
- A valid XPath 1.0 expression.context
- The context node.namespaceBindings
- A collection of namespace bindings for the XPath expression,
where each entry maps a namespace URI (key) to a prefix
(value). It may be null
.public static void assertXPath2(String expr, Source source, Map<String,String> namespaceBindings)
true
for the
given XML source. That is, the result set is not empty.expr
- An XPath 2.0 expression.source
- A Source object representing an XML resource.namespaceBindings
- A collection of namespace bindings for the XPath expression,
where each entry maps a namespace URI (key) to a prefix
(value). It may be null
.public static void assertSchemaValid(Validator validator, Source source)
validator
- The Validator to use.source
- The XML Source to be validated.public static void assertSchematronValid(URL schemaRef, Source xmlSource)
schemaRef
- A URL that denotes the location of a Schematron schema.xmlSource
- The XML Source to be validated.public static void assertFeatureAvailability(String id, boolean isAvailable, WFSClient wfsClient)
//wfs:member/*[@gml:id = '$id']
id
- The feature identifier (assigned by the system).isAvailable
- A boolean value asserting that the feature either is (
true
) or is not (false
) available.wfsClient
- A WFSClient component that interacts with the SUT.public static void assertFeatureProperties(String gmlId, Map<String,Object> properties, Map<String,String> nsBindings, WFSClient wfsClient)
gmlId
- A GML object identifier (gml:id).properties
- A collection of feature properties containing {name: value}
entries, where the name is an XPath expression.nsBindings
- A collection of namespace bindings for the supplied
properties, where each entry is a {namespace-URI: prefix}
pair.wfsClient
- A WFSClient component that interacts with the SUT.public static void assertDescendantElementCount(Document xmlEntity, QName elementName, int expectedCount)
xmlEntity
- A Document representing an XML entity.elementName
- The qualified name of the element.expectedCount
- The expected number of occurrences.public static void assertStatusCode(int actualCode, int[] expectedCodes)
actualCode
- The actual status code.expectedCodes
- An int[] array containing the expected status codes.Copyright © 2013. All rights reserved.