---
schema_version: "1"
id: f74f89b1bbd8375ffd3c7ee7ba5d1ef76c854e7a7d0d05f2ef9fd3aa7dcf12e7
title: MUnit Iterable and Map Matchers Reference
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/munit/latest/iterable-map-matchers-reference.md
canonical_url: https://docs.mulesoft.com/munit/latest/iterable-map-matchers-reference
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 21a3b312d2ed5d7344dba8781df4723328d27f58d423191f49b53119c1b72d85
description: MuleSoft Documentation Site
release: "3.7"
latest: true
---
---
product: MUnit
version: 3.7
is-latest-version: true
---

# MUnit Iterable and Map Matchers Reference

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

![logo acb active](/mulesoft/current/en-us/_/img/icons/anypoint-code-builder.svg "Anypoint Code Builder")Anypoint Code
Builder

![logo studio active](/mulesoft/current/en-us/_/img/icons/studio.svg "Anypoint Studio")Anypoint Studio

MUnit Iterable and Map matchers are matcher functions for asserting conditions on collections and
maps during a MUnit test. Use them with the Assert That processor to check items, keys, values, and
sizes of iterables and maps.

## everyItem(Matcher)

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

Example

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

Example

```xml
<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

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

Example

```xml
<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

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

Example

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

## isEmpty()

Checks that the expression is an empty collection.

Example

```xml
<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

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

Example

```xml
<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

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

Example

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

## See Also

- [MUnit Matchers](https://docs.mulesoft.com/munit/latest/munit-matchers)

- [Core Matchers Reference](https://docs.mulesoft.com/munit/latest/core-matchers-reference)

- [String Matchers Reference](https://docs.mulesoft.com/munit/latest/string-matchers-reference)

- [Comparable Matchers Reference](https://docs.mulesoft.com/munit/latest/comparable-matchers-reference)
