MashZone NextGen 10.2 | Appendix | Legacy Presto components | Mashables and Mashups | Mashups in EMML | Writing Mashups in EMML | Supporting Debugging | <assert>
 
<assert>
 
<assert> Examples
Use <assert> to add error checking assertions within a mashup, operation, macro or other statement. Assertions are evaluated at runtime and throw exceptions if they evaluate to false.
Assertions may compare any two of the following:
*A variable
*An XPath expression of any kind
*A literal value
*A count of nodes identified by an XPath expression
*A count of the levels of descendants from a node or node set identified by an XPath expression
Assertion comparisons for variables or expressions that result in simple types check both the datatype and the value. For variables or expressions that are a document type (complex), the comparison checks for node-by-node equality both in node names and values. Whitespace, however, is not considered in document-type comparisons.
When assertions fail, they throw an AssertionFailedException with appropriate messages. For more information and examples, see Assertions for Simple Types, Assertions for Document Types or Counts and Element Depths in Assertions. See also Working Samples for information on sample mashups that use this statement.
Can Contain
Empty
Allowed In
mashup | catch | else | elseif | for | foreach | if | macro | operation | sequence | try | while
Attributes
Name
Required
Description
actualexpr
An XPath expression identifying one or more nodes, values or any valid calculation to be used in the comparison for this assertion. Assertions must contain at least one of actualexpr or actualvar.
actualvar
The variable to be used in the comparison for this assertion. For variables that are a document type, the comparison is made for all nodes.
Assertions must contain at least one of actualexpr or actualvar.
equals
Optionally determines what operator is used for the comparison of this assertion. True (the default) uses equals as the operator or false uses not equals.
expectedexpr
An XPath expression identifying one or more nodes, values or any valid calculation that the actualexpr or actualvar should be compared to. Assertions must contain at least one of expectedexpr, expectedvar, literal, count or elementdepth.
expectedvar
The variable that the actualexpr or actualvar should be compared to. Assertions must contain at least one of expectedexpr, expectedvar, literal, count or elementdepth.
literal
The literal value that the actualexpr or actualvar should be compared to. This value is treated as a string.
Assertions must contain at least one of expectedexpr, expectedvar, literal, count or elementdepth.
count
An XPath expression identifying a set of one or more nodes. The actualexpr or actualvar is compared against the number of nodes found in this node set.
Assertions must contain at least one of expectedexpr, expectedvar, literal, count or elementdepth.
elementdepth
An XPath expression identifying a set of one or more nodes. The actualexpr or actualvar is compared against the number of levels of descendants plus 1 (for the node itself) of the nodes in this node set.
Assertions must contain at least one of expectedexpr, expectedvar, literal, count or elementdepth.

Copyright © 2013-2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Innovation Release