---
schema_version: "1"
id: 88a520607b687578c6d5d16f5a541381cff8ceaa5e68ee80f7e37fa84dfe23c1
title: Resource Matchers
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/munit/3.6/resource-matchers-reference.md
canonical_url: https://docs.mulesoft.com/munit/3.6/resource-matchers-reference
source_site: docs.mulesoft.com
content_type: documentation
content_hash: c090c088164f3ac8b5f8dd6874618d2fe08f8a222d0d88d44ec27905755d1ec7
description: MuleSoft Documentation Site
release: "3.6"
latest: false
---
---
product: MUnit
version: 3.6
---

# Resource Matchers

> 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

## getResourceAsStream(String)

Returns the resource from the path String as a stream.

Example

```xml
<set-payload
  value="#[MunitTools::getResourceAsStream('util/files/example.txt')]"/>
```

## getResourceAsReusableStream(String)

Returns the resource from the path String as a reusable stream.

Example

```xml
 <set-payload
   value="#[MunitTools::getResourceAsReusableStream('util/files/example.txt')]"/>
```

## getResourceAsString(path:String,encoding:String)

Returns the resource from the path String as a String, where the second parameter (encoding) is
optional.

Example

```xml
<set-payload
  value="#[MunitTools::getResourceAsString('util/files/example.txt')]"/>
```

You can also specify the encoding:

Example

```xml
<set-payload
  value="#[MunitTools::getResourceAsString('util/files/exampleISO.txt', 'ISO-8859-1')]"/>
```

## getResourceAsByteArray(String)

Returns the resource from the path String as a byte array.

Example

```xml
 <set-payload
   value="#[MunitTools::getResourceAsByteArray('util/files/example.txt')]"/>
```

## queueSize(String)

Returns the size of the queue specified inside `#[MunitTools::queueSize()]`.

For example, to assert the size of a queue named `QUEUE_SIZE`:

Example

```xml
<munit:execution>
  <munit-tools:queue queueName="QUEUE_SIZE">
    <munit-tools:value>#['EXAMPLE']</munit-tools:value>
  </munit-tools:queue>
</munit:execution>

<munit:validation>
  <munit-tools:assert-that expression="#[MunitTools::queueSize('QUEUE_SIZE')]" is="#[MunitTools::equalTo(1)]"/>
</munit:validation>
```

## createMessage(payload: Any, mimeType: String|Null , attributes: Any, attributeMimeType: String|Null)

Creates a Mule message with the specified attributes.

Example

```xml
<munit:execution>
     <set-payload value="#[MunitTools::createMessage( 'ITEM-1',  'text/plain', { property : 'ATTRIBUTE-1'}, null )]"/>
 </munit:execution>
```

## See Also

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

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

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

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