1
2
3
4
5
6
7
8
9
10 package org.mule.mule.model;
11
12 import org.mule.api.model.InvocationResult;
13 import org.mule.model.resolvers.ExplicitMethodEntryPointResolver;
14 import org.mule.tck.AbstractMuleTestCase;
15
16 public class ExplicitMethodEntryPointResolverTestCase extends AbstractMuleTestCase
17 {
18 public void testMethodSetPass() throws Exception
19 {
20 ExplicitMethodEntryPointResolver resolver = new ExplicitMethodEntryPointResolver();
21 resolver.addMethod("someBusinessMethod");
22 InvocationResult result = resolver.invoke(new MultiplePayloadsTestObject(), getTestEventContext("blah"));
23 assertEquals(result.getState(), InvocationResult.STATE_INVOKED_SUCESSFUL);
24 }
25
26 public void testMethodSetMatchFirst() throws Exception
27 {
28 ExplicitMethodEntryPointResolver resolver = new ExplicitMethodEntryPointResolver();
29 resolver.addMethod("someBusinessMethod");
30 resolver.addMethod("someSetter");
31 InvocationResult result = resolver.invoke(new MultiplePayloadsTestObject(), getTestEventContext("blah"));
32 assertEquals(result.getState(), InvocationResult.STATE_INVOKED_SUCESSFUL);
33 }
34
35 public void testMethodNotFound() throws Exception
36 {
37 ExplicitMethodEntryPointResolver resolver = new ExplicitMethodEntryPointResolver();
38 resolver.addMethod("noMethod");
39 resolver.addMethod("noMethod2");
40 InvocationResult result = resolver.invoke(new MultiplePayloadsTestObject(), getTestEventContext("blah"));
41 assertEquals(result.getState(), InvocationResult.STATE_INVOKED_FAILED);
42 }
43
44 public void testNoMethodSet() throws Exception
45 {
46 ExplicitMethodEntryPointResolver resolver = new ExplicitMethodEntryPointResolver();
47 try
48 {
49 resolver.invoke(new MultiplePayloadsTestObject(), getTestEventContext("blah"));
50 fail("method property is not set, this should cause an error");
51 }
52 catch (IllegalStateException e)
53 {
54
55 }
56 }
57 }