Free MuleSoft CONNECT Keynote & Expo Pass Available!

Register now+
Nav

Core Matchers Reference

nullValue()

Checks that the expression is null.

Example

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

notNullValue()

Checks that the expression is not null.

Example

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

withMediaType(String)

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

Example

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

withEncoding(String)

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

Example

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

both(, Matcher)

Checks that both provided matchers are successful.

Example

         
      
1
2
3
<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

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

not(Matcher)

Checks if the provided matcher is not successful.

Example

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

anyOf(Array<Matchers>)

Checks if any of the matchers are successful.

Example

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

allOf(Array<Matchers>)

Checks if all of the matchers are successful.

Example

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