Free MuleSoft CONNECT Keynote & Expo Pass Available!

Register now+
Nav

Iterable and Map Matchers Reference

everyItem(Matcher)

Checks that every element in the expression matches the specified matcher.

Example

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

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

hasItem(Matcher)

Checks that any element in the expression matches the specified matcher.

Example

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

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

hasSize(Matcher)

Checks that the size of the expression matches the specified matcher.

Example

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

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

isEmpty()

Checks that the expression is an empty collection.

Example

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

hasKey(Matcher)

Checks that the expression has a key that matches the specified matcher.

Example

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

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

hasValue(Matcher)

Checks that the expression has a value that matches the specified matcher.

Example

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

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