MunitMessageProcessorCall messageProcessorCall = buildCall(event);
runSpyAssertion(manager.getBetterMatchingBeforeSpyAssertion(messageProcessorCall), event);
registerCall(manager, messageProcessorCall);
MessageProcessorBehavior behavior = manager.getBetterMatchingBehavior(messageProcessorCall);
if (behavior != null)
{
if (behavior.getExceptionToThrow() != null)
{
runSpyAssertion(manager.getBetterMatchingAfterSpyAssertion(messageProcessorCall), event);
throw behavior.getExceptionToThrow();
}
if ( behavior.getMuleMessageTransformer() != null ){
event.setMessage(behavior.getMuleMessageTransformer().transform(event.getMessage()));
}
runSpyAssertion(manager.getBetterMatchingAfterSpyAssertion(messageProcessorCall), event);
return event;
}