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.email.issues;
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.tck.junit4.rule.DynamicPort;
13  
14  import org.junit.Rule;
15  import org.junit.Test;
16  
17  import static org.junit.Assert.assertEquals;
18  import static org.junit.Assert.assertNotNull;
19  
20  public class ExceptionHandlingMule2167TestCase extends FunctionalTestCase
21  {
22  
23      public static final String MESSAGE = "a message";
24      public static final long WAIT_MS = 3000L;
25  
26      @Rule
27      public DynamicPort dynamicPort = new DynamicPort("port1");
28  
29      @Override
30      protected String getConfigResources()
31      {
32          return "exception-handling-mule-2167-test.xml";
33      }
34  
35      @Test
36      public void testDefaultConfig() throws Exception
37      {
38          MuleClient client = new MuleClient(muleContext);
39          client.dispatch("vm://in-default", MESSAGE, null);
40          MuleMessage message = client.request("vm://out-default", WAIT_MS);
41          assertNotNull("null message", message);
42          assertNotNull("null payload", message.getPayload());
43          assertEquals(MESSAGE, message.getPayloadAsString());
44      }
45  
46  }