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.mule.model;
8   
9   import org.mule.api.model.InvocationResult;
10  import org.mule.model.resolvers.CallableEntryPointResolver;
11  import org.mule.tck.junit4.AbstractMuleContextTestCase;
12  import org.mule.tck.testmodels.fruit.Apple;
13  import org.mule.tck.testmodels.fruit.WaterMelon;
14  
15  import org.junit.Test;
16  
17  import static org.junit.Assert.assertEquals;
18  
19  public class CallableEntryPointDiscoveryTestCase extends AbstractMuleContextTestCase
20  {
21  
22      @Test
23      public void testBadMatch() throws Exception
24      {
25          CallableEntryPointResolver resolver = new CallableEntryPointResolver();
26          InvocationResult result = resolver.invoke(new WaterMelon(), getTestEventContext(new StringBuffer("foo")));
27          assertEquals("Service doesn't implement Callable", result.getState(), InvocationResult.State.NOT_SUPPORTED);
28      }
29  
30      @Test
31      public void testGoodMatch() throws Exception
32      {
33          CallableEntryPointResolver resolver = new CallableEntryPointResolver();
34          InvocationResult result = resolver.invoke(new Apple(), getTestEventContext("blah"));
35          assertEquals(result.getState(), InvocationResult.State.SUCCESSFUL);
36      }
37  }