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

# MUnit String 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 String matchers are matcher functions for asserting conditions on String expressions during a
MUnit test. Use them with the Assert That processor to check for substrings, prefixes, suffixes,
empty values, and case-insensitive equality.

## containsString(String)

Checks that the expression contains the specified String.

Example

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

## startsWith(String)

Checks that the expression starts with the specified String.

Example

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

## endsWith(String)

Checks that the expression ends with the specified String.

Example

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

## isEmptyString()

Checks that the expression has zero length.

Example

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

## isEmptyOrNullString()

Checks that the expression is null, or has zero length.

Example

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

## equalToIgnoringCase(String)

Checks that the expression is equal to the specified String, ignoring case.

Example

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

## equalToIgnoringWhiteSpace(String)

Checks that the expression is equal to the string disregarding leading and trailing white spaces,
and compression all inner white spaces to a single space.

Example

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

## stringContainsInOrder(Array<String>)

Checks that the expression contains all of the specified substrings, regardless of the order of
their appearance.

Example

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

## See Also

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

- [Core Matchers Reference](https://docs.mulesoft.com/munit/latest/core-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)
