@Test
  public void testNoCatch() throws Exception {
    OutboundEndpoint endpoint = createTestOutboundEndpoint(null, null);
    InterceptingMessageProcessor mp = new ExceptionHandlingMessageProcessor();
    TestListener listener = new TestListener();
    mp.setListener(listener);

    MuleEvent event = createTestOutboundEvent();

    MuleEvent result = mp.process(event);

    assertSame(event, listener.sensedEvent);
    assertSame(event, result);
    assertNull(exceptionListener.sensedException);
  }
  @Test
  public void testCatchDispatchExceptionSync() throws Exception {
    OutboundEndpoint endpoint = createTestOutboundEndpoint(null, null);
    InterceptingMessageProcessor mp = new ExceptionHandlingMessageProcessor();
    mp.setListener(new ExceptionThrowingMessageProcessr());

    MuleEvent event = createTestOutboundEvent(exceptionListener);

    MuleEvent resultEvent = mp.process(event);
    assertNotNull(resultEvent);
    assertNotNull("exception expected", resultEvent.getMessage().getExceptionPayload());
    assertTrue(
        resultEvent.getMessage().getExceptionPayload().getException()
            instanceof IllegalStateException);

    assertEquals(NullPayload.getInstance(), resultEvent.getMessage().getPayload());
    assertNotNull(exceptionListener.sensedException);
  }