---
schema_version: "1"
id: b3b34b4b1badd013356230606d22ef2a58319c6704bb8eb67a669b50afaa754d
title: MUnit Core Matchers Reference
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/munit/latest/core-matchers-reference.md
canonical_url: https://docs.mulesoft.com/munit/latest/core-matchers-reference
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 60e632a3432d4a32f7838e4f3c45d04aa17f0d457263a0eedecf51c2d72ea5ad
description: MuleSoft Documentation Site
release: "3.7"
latest: true
---
---
product: MUnit
version: 3.7
is-latest-version: true
---

# MUnit Core 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 core matchers are general-purpose matcher functions for use with the Assert That processor in
a MUnit test. Use them to check for null values, media types, encodings, and logical combinations of
other matchers.

## nullValue()

Checks that the expression is null.

Example

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

## notNullValue()

Checks that the expression is not null.

Example

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

## withMediaType(String)

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

Example

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

## withEncoding(String)

Checks that the expression encoding is the one specified.

Example

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

## both(Matcher, Matcher)

Checks that both provided matchers are successful.

Example

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

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

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

Example

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

## anyOf(Array<Matcher>)

Checks if any of the matchers are successful.

Example

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

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

## See Also

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

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

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

- [Iterable and Map Matchers Reference](https://docs.mulesoft.com/munit/latest/iterable-map-matchers-reference)
