Hear from Salesforce leaders on how to create and deploy Agentforce agents.
Contact Us 1-800-596-4880

Core Matchers Reference

nullValue()

Checks that the expression is null.

Example
<munit-tools:assert-that
expression="#[payload]"
is="#[MunitTools::nullValue()]"/>
xml

notNullValue()

Checks that the expression is not null.

Example
<munit-tools:assert-that
expression="#[payload]"
is="#[MunitTools::notNullValue()]"/>
xml

withMediaType(String)

Checks that the expression’s media type is the one specified.

Example
<munit-tools:assert-that
expression="#[payload]"
is="#[MunitTools::withMediaType('text/xml')]"/>
xml

withEncoding(String)

Checks that the expression’s encoding is the one specified.

Example
<munit-tools:assert-that
expression="#[payload]"
is="#[MunitTools::withEncoding('UTF-8')]"/>
xml

both(Matcher, Matcher)

Checks that both provided matchers are successful.

Example
<munit-tools:assert-that
expression="#[payload]"
is="#[MunitTools::both(MunitTools::notNullValue(),MunitTools::equalTo('example'))]"/>
xml

either(Matcher,Matcher)

Checks that at least one of the matchers is successful.

Example
<munit-tools:assert-that
expression="#[payload]"
is="#[MunitTools::either(MunitTools::nullValue(),MunitTools::equalTo(0))]"/>
xml

not(Object)

Checks if the provided matcher is not successful.

Example
<munit-tools:assert-that
expression="#[payload]"
is="#[MunitTools::not(0)]"/>
xml
Example
<munit-tools:assert-that
expression="#[payload]"
is="#[MunitTools::not(MunitTools::equalTo(0))]"/>
xml

anyOf(Array<Matcher>)

Checks if any of the matchers are successful.

Example
<munit-tools:assert-that
expression="#[payload]"
is="#[MunitTools::anyOf([MunitTools::notNullValue(),MunitTools::withMediaType('text/xml'),MunitTools::isEmptyString()])]"/>
xml

allOf(Array<Matcher>)

Checks if all of the matchers are successful.

Example
<munit-tools:assert-that
expression="#[payload]"
is="#[MunitTools::allOf([MunitTools::notNullValue(),MunitTools::withMediaType('text/xml'),MunitTools::isEmptyString()])]"/>
xml