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()]"/>

notNullValue()

Checks that the expression is not null.

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

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')]"/>

withEncoding(String)

Checks that the expression encoding is the one specified.

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

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'))]"/>

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))]"/>

not(Object)

Checks if the provided matcher is not successful.

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

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()])]"/>

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()])]"/>