View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.test.integration.messaging.meps;
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.assertTrue;
17  
18  /**
19   * @see MULE-4512
20   */
21  public class SynchronousResponseExceptionTestCase extends FunctionalTestCase
22  {
23      
24      @Override
25      protected String getConfigResources()
26      {
27          return "org/mule/test/integration/messaging/meps/synchronous-response-exception.xml";
28      }
29  
30      @Test
31      public void testComponentException() throws Exception
32      {
33          MuleClient client = new MuleClient(muleContext);
34          MuleMessage reply = client.send("vm://in1", "request", null);
35          assertTrue("Response should be null but is " + reply.getPayload(), reply.getPayload() instanceof NullPayload);
36      }
37  
38      @Test
39      public void testOutboundRoutingException() throws Exception
40      {
41          MuleClient client = new MuleClient(muleContext);
42          MuleMessage reply = client.send("vm://in2", "request", null);
43          assertTrue("Response should be null but is " + reply.getPayload(), reply.getPayload() instanceof NullPayload);
44      }
45  
46      @Test
47      public void testInboundTransformerException() throws Exception
48      {
49          MuleClient client = new MuleClient(muleContext);
50          MuleMessage reply = client.send("vm://in3", "request", null);
51          assertTrue("Response should be null but is " + reply.getPayload(), reply.getPayload() instanceof NullPayload);
52      }
53  
54      @Test
55      public void testOutboundTransformerException() throws Exception
56      {
57          MuleClient client = new MuleClient(muleContext);
58          MuleMessage reply = client.send("vm://in4", "request", null);
59          assertTrue("Response should be null but is " + reply.getPayload(), reply.getPayload() instanceof NullPayload);
60      }
61  
62      @Test
63      public void testResponseTransformerException() throws Exception
64      {
65          MuleClient client = new MuleClient(muleContext);
66          MuleMessage reply = client.send("vm://in5", "request", null);
67          assertTrue("Response should be null but is " + reply.getPayload(), reply.getPayload() instanceof NullPayload);
68      }
69  }
70  
71