BookatlasTwo-Day MuleSoft → Salesforce Bootcamp
189 / 278 · Module 13 — MUnit · filtered: code← prev⊞ allnext →

13.21Mock Salesforce error

This is where MUnit becomes extremely valuable.

Instead of waiting for Salesforce to actually fail:

Mock Salesforce Upsert
↓
throw SALESFORCE:CONNECTIVITY

MUnit's mock processor can be configured to return a Mule error type, allowing you to trigger the application's real error handling.

Conceptually:

<munit-tools:mock-when
    processor="salesforce:upsert">

    <munit-tools:then-return>
        <munit-tools:error
            typeId="#['SALESFORCE:CONNECTIVITY']"/>
    </munit-tools:then-return>

</munit-tools:mock-when>

Now your production error handler runs.