The MUnit DataWeave Assertions Library is a set of DataWeave matcher functions for writing assertions in MUnit tests. Use it with the Assert Expression processor to validate values such as strings, numbers, arrays, and objects using DataWeave syntax.
dw::test::Asserts
This module contains the set of core Matchers to use in your tests
Example
%dw 2.0
import dw::test::Asserts
---
payload must beObject()
Validates if a payload is of type Object
Functions
contain
equalToResource
equalToResource(String, String, Object): Matcher<Any>
Validates that the given value is equal to the content of a resource file
The resource file must belong to the classpath
%dw 2.0
import dw::test::Asserts
---
{ name: "Lionel", lastName: "Messi" } must equalToResource("user.json", "application/json")