Free MuleSoft CONNECT Keynote & Expo Pass Available!

Register now+
Nav
You are viewing an older version of this section. Click here to navigate to the latest version.

Verify Event Processor

The Verify Event Processor allows you to verify if a processor was called.

For example, you can validate if a specific message processor has been called with a particular set of attributes a specific number of times.

When defining a verification, you are telling MUnit to fail a test if the verification is not successful.

You can define verifications over any message processor, even if you haven’t created a mock for it.


         
      
1
2
3
4
5
<munit-tools:verify-call processor="http:request*" atLeast="1">
   <munit-tools:with-attributes>
       <munit-tools:with-attribute attributeName="doc:id" whereValue="#['bdac4beb-858f-4049-b8e8-db50f7bf5db6']"/>
   </munit-tools:with-attributes>
</munit-tools:verify-call>
Attribute Name Description

eventProcessor

Describes which event processor you want to mock. The description takes the form {name-space}:{event-processor-name}. It supports regular expressions.

times

(Default = 1.) Defines the verification as successful if the event processor was called N and only N number of times.

atLeast

Defines the verification as successful if the event processor was called a minimum of N number of times.

atMost

Defines the verification as successful if the event processor was called maximum of N number of times.

The attributes times, atLeast, atMost, are mutually exclusive. Only one should be used.

The eventProcessor attribute accepts regular expressions. You could create the same verification as .*:http-request. In the example above, we define a verification for a event processor named http-request, disregarding which namespace the event processor belongs to.

The regular expression language is the same as Java.

In this topic: