Free MuleSoft CONNECT Keynote & Expo Pass Available!

Register now+
Nav

String Matchers Reference

containsString(String)

Checks that the expression contains the specified String.

Example

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

startsWith(String)

Checks that the expression starts with the specified String.

Example

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

endsWith(String)

Checks that the expression ends with the specified String.

Example

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

isEmptyString()

Checks that the expression has zero length.

Example

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

isEmptyOrNullString()

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

Example

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

equalToIgnoringCase(String)

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

Example

         
      
1
2
3
<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

         
      
1
2
3
<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

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