1
2
3
4
5
6
7 package org.mule.test.components;
8
9 import org.mule.api.MuleMessage;
10 import org.mule.module.client.MuleClient;
11 import org.mule.tck.junit4.FunctionalTestCase;
12 import org.mule.transport.NullPayload;
13
14 import org.junit.Test;
15
16 import static org.junit.Assert.assertFalse;
17 import static org.junit.Assert.assertNotNull;
18 import static org.junit.Assert.assertTrue;
19
20 public class ComponentReturningNullFlowTestCase extends FunctionalTestCase
21 {
22
23 @Override
24 protected String getConfigResources()
25 {
26 return "org/mule/test/components/component-returned-null.xml";
27 }
28
29 @Test
30 public void testNullReturnStopsFlow() throws Exception
31 {
32 MuleClient client = new MuleClient(muleContext);
33
34 MuleMessage msg = client.send("vm://in", "test data", null);
35 assertNotNull(msg);
36 final String payload = msg.getPayloadAsString();
37 assertNotNull(payload);
38 assertFalse("ERROR".equals(payload));
39 assertTrue(msg.getPayload() instanceof NullPayload);
40 }
41
42 public static final class ComponentReturningNull
43 {
44 public String process(String input)
45 {
46 return null;
47 }
48 }
49 }