Contact Us 1-800-596-4880

Iterable and Map Matchers Reference

everyItem(Matcher)

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

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

hasItem(Object)

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

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

hasSize(Matcher|Integer)

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

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

isEmpty()

Checks that the expression is an empty collection.

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

hasKey(Matcher|String)

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

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

hasValue(Object)

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

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