View Javadoc

1   /*
2    * $Id$
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.endpoint.inbound;
12  
13  import org.mule.api.MuleEvent;
14  import org.mule.api.endpoint.InboundEndpoint;
15  import org.mule.api.processor.MessageProcessor;
16  import org.mule.endpoint.AbstractMessageProcessorTestCase;
17  import org.mule.message.DefaultExceptionPayload;
18  
19  public class InboundExceptionDetailsProcessorTestCase extends AbstractMessageProcessorTestCase
20  {
21  
22      public void testProcess() throws Exception
23      {
24          InboundEndpoint endpoint = createTestInboundEndpoint(null, null);
25          MessageProcessor mp = new InboundExceptionDetailsMessageProcessor(endpoint.getConnector());
26  
27          MuleEvent event = createTestInboundEvent(endpoint);
28          event.getMessage().setExceptionPayload(new DefaultExceptionPayload(new RuntimeException()));
29  
30          MuleEvent result = mp.process(event);
31  
32          assertNotNull(result);
33          final int status = result.getMessage().getOutboundProperty("status", 0);
34          assertEquals(500, status);
35  
36      }
37  }