---
schema_version: "1"
id: d5104d82f2136359bbce28164b04d8913ba4105927deb39d33aeaf67d35f7ab5
title: Comparable Matchers Reference
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/munit/2.3/comparable-matchers-reference.md
canonical_url: https://docs.mulesoft.com/munit/2.3/comparable-matchers-reference
source_site: docs.mulesoft.com
content_type: documentation
content_hash: faff422929ec4b23a03fe330bb4aef6150d2c598c1aa7013bd2141b4e5a5dfc9
description: MuleSoft Documentation Site
release: "2.3"
latest: false
---
---
product: MUnit
version: 2.3
---

# Comparable Matchers Reference

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

> [!NOTE] `Comparable` is a DataWeave type that represents all the types that can be compared to
> each other.  
> Allowed primitives are String, Number, Boolean, DateTime, LocalDateTime, LocalTime, Time, and
> TimeZone that you can pass any primitive value such as an integer or a date.

## greaterThan(Comparable)

Checks that the expression is greater than the specified value.

Example

```xml
<munit-tools:assert-that
expression="#[payload]"
is="#[MunitTools::greaterThan(|2017-08-09|)]"/>
```

Example

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

## greaterThanOrEqualTo(Comparable)

Checks that the expression is greater than or equal to the specified value.

Example

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

Example

```xml
<munit-tools:assert-that
expression="#[payload]"
is="#[MunitTools::greaterThanOrEqualTo(|2017-08-09|)]"/>
```

## lessThan(Comparable)

Example

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

Example

```xml
<munit-tools:assert-that
expression="#[payload]"
is="#[MunitTools::lessThan(|2017-08-09|)]"/>
```

## lessThanOrEqualTo(Comparable)

Checks that the expression is less than or equal to the specified value.

Example

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

Example

```xml
<munit-tools:assert-that
expression="#[payload]"
is="#[MunitTools::lessThanOrEqualTo(|2017-08-09|)]"/>
```

## closeTo(Number, Number)

Checks that the expression is close to the first number, using the second number as a delta value.  
In other words, checks that the expression belongs to the range defined by the first number +/- the
second number.

Example

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

<!--
  This evaluates if the expression is between 0.99 (1 - 0.01) and 1.01 (1 + 0.01)
-->
```

## equalTo(Object)

Checks that the expression is equal to a specific value.

Example

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

Example

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

This matcher also accepts Dataweave objects.

Example

```xml
<munit-tools:assert-that
expression="#[{example1: 1 , example2: 2}]"
is="#[MunitTools::equalTo({example1: 1 , example2: 2})]"/>
```

The matcher validates that the keys and their respective values are the same.  
The order in the matcher must be the same as the one in the expression or the assertion fails.

Example

```xml
<munit-tools:assert-that
expression="#[{example1: 1 , example2: 2}]"
is="#[MunitTools::equalTo({example2: 2 , example1: 1})]"/>

<!-- This assertion fails -->
```

Example

```xml
<munit-tools:assert-that
expression="#[[1, 2, 3]]"
is="#[MunitTools::equalTo([3, 2, 1])]"/>

<!-- This assertion fails -->
```

## See Also

- [DataWeave Comparable Type](https://docs.mulesoft.com/dataweave/latest/dataweave-types#dw_type_comparable)

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

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

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

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