Getting started Community Training Tutorials Documentation APIs, AI & Tools
<munit-tools:assert-that
expression="#[payload]"
is="#[MunitTools::equalTo('example')]"
message="The payload should be ‘example’"/>
Assert That
Assert That
You're viewing an older version of the documentation. You can switch to the latest version or use the version selector in the left navigation.
The Assert That event processor allows you to run assertions to validate the state of a Mule event’s content. You can use the Assert That processor to validate the Mule event after the production code runs.
The Assert That processor uses a set of DataWeave functions called MUnit matchers to define the assertion conditions for any value in an expression.
For example, to assert that a payload is equal to a certain value, configure the Assert That processor using the equalTo() matcher.
<munit-tools:assert-that
expression="#[payload]"
is="#[MunitTools::equalTo('example')]"
message="The payload should be ‘example’"/>
Or you can also check if the payload is null using the nullValue() matcher.
<munit-tools:assert-that
expression="#[payload]"
is="#[MunitTools::nullValue()]"
message="The payload should be null"/>
See MUnit Matchers for more information.
If these assertion fails, the processor throws a java.lang.AssertionError.