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.transport.vm.functional;
8   
9   import org.hamcrest.core.Is;
10  import org.hamcrest.core.IsNull;
11  import org.junit.Test;
12  import org.mule.api.MuleMessage;
13  import org.mule.module.client.MuleClient;
14  import org.mule.tck.junit4.FunctionalTestCase;
15  import org.mule.transport.NullPayload;
16  
17  import static org.junit.Assert.assertThat;
18  
19  public class VmRequestReplyTestCase extends FunctionalTestCase {
20  
21      @Override
22      protected String getConfigResources() {
23          return "vm/vm-request-reply-config.xml";
24      }
25  
26      @Test
27      public void testVmReplyTo() throws Exception
28      {
29          MuleClient client = new MuleClient(muleContext);
30          MuleMessage result = client.send("vm://in4vm", "some data", null);
31          assertThat(result, IsNull.<Object>notNullValue());
32          assertThat(result.getExceptionPayload(), IsNull.<Object>nullValue());
33          assertThat(result.getPayload() instanceof NullPayload, Is.is(false));
34          assertThat(result.getPayloadAsString(), Is.is("HELLO"));
35      }
36  }