when(mockMessagingExceptionHandler.handleException(mockMessagingException, mockEvent)).thenAnswer(new Answer<Object>()
{
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable
{
CatchMessagingExceptionStrategy exceptionStrategy = new CatchMessagingExceptionStrategy();
exceptionStrategy.setMuleContext(mockMuleContext);
when(mockMuleContext.getNotificationManager()).thenReturn(mock(ServerNotificationManager.class));
when(mockMuleContext.getRegistry()).thenReturn(mock(MuleRegistry.class));
exceptionStrategy.handleException((Exception) invocationOnMock.getArguments()[0], (MuleEvent) invocationOnMock.getArguments()[1]);
return mockResultEvent;
}
});
return mockResultEvent;
}