Assert Processors

All assert event processors change of name space to 'assert'.
We are replacing all assert event processors with only one event processor.

Assert processor for MUnit 2.x
<munit-tools:assert-that expression="#[]" is="#[MunitTools::equalTo(...)]" message=""/>
The expression is expected.

Unary assertion should be implemented as shown below:

Assert Payload

Assert Payload in MUnit 1.x
<assert:payload-equals expectedValue="'#[['value 1','value 2']]"   message="oops!"/>
Assert Payload in MUnit 2.x
<munit-tools:assert-that expression="#[payload]" is="#[MunitTools::equalTo(['value 1','value 2'])]" message="oops!"/>

Assert Null

Assert Null in MUnit 1.x
<munit:assert-null message="oops!"/>
Assert Null in MUnit 2.x
<munit-tools:assert-that expression="#[payload]" is="#[MunitTools::nullValue()]" message="oops!"/>

Assert Not Null

Assert Not Null in MUnit 1.x
<munit:assert-not-null message="oops!"/>
Assert Not Null in MUnit 2.x
<munit-tools:assert-that expression="#[payload]" is="#[MunitTools::notNullValue()]" message="oops!"/>

Assert False

Assert False in MUnit 1.x
<munit:assert-false message="oops!" condition="#[ 1 != 1 || payload.length != 0]"/>
Assert False in MUnit 2.x
<munit-tools:assert-that expression="#[ 1 != 1 || payload.length != 0]" is="#[MunitTools::equalTo(false)]" message="oops!"/>

Assert True

Assert True in MUnit 1.x
<munit:assert-true message="oops!" condition="#[#[ 1 == 1 &amp;&amp; payload.length == 0]]" doc:name="Assert True"/>
Assert True in MUnit 2.x
<munit-tools:assert-that expression="#[ 1 != 1 || payload.length != 0]" is="#[MunitTools::equalTo(true)]" message="oops!"/>

Assert Fail

There are no changes in the syntax for the fail assertion processor:

<munit:fail message="This should not happen"/>

Binaries assertion should be implemented as shown below:

Assert Equals

Assert Equals in MUnit 1.x
<munit:assert-on-equals message="oops!" expectedValue="#['expected']" actualValue="#['actual_value']"/>
Assert Equals in MUnit 2.x
<munit-tools:assert-that expression="#['expected']" is="#[MunitTools::equalTo('actual_value')]" message="oops!" />

Assert Not Equals

Assert Not Equals in MUnit 1.x
<munit:assert-not-same message="oops!" expectedValue="#['']" actualValue="#[payload]"/>
Assert Not Equals in MUnit 2.x
<munit-tools:assert-that expression="#['expected']" is="#[MunitTools::not(equalTo('actual_value'))]" message="oops!" />

Assert Custom

There are no changes in the syntax for the custom asserting processor:

<munit-tools:run-custom assertion-ref="your.package.customAssertion"/>

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub