1
2
3
4
5
6
7
8
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 import org.junit.Test;
20
21 import static org.junit.Assert.assertEquals;
22 import static org.junit.Assert.assertNotNull;
23
24 public class InboundExceptionDetailsProcessorTestCase extends AbstractMessageProcessorTestCase
25 {
26
27 @Test
28 public void testProcess() throws Exception
29 {
30 InboundEndpoint endpoint = createTestInboundEndpoint(null, null);
31 MessageProcessor mp = new InboundExceptionDetailsMessageProcessor(endpoint.getConnector());
32
33 MuleEvent event = createTestInboundEvent(endpoint);
34 event.getMessage().setExceptionPayload(new DefaultExceptionPayload(new RuntimeException()));
35
36 MuleEvent result = mp.process(event);
37
38 assertNotNull(result);
39 final int status = result.getMessage().getOutboundProperty("status", 0);
40 assertEquals(500, status);
41 }
42 }