1
2
3
4
5
6
7
8
9
10
11 package org.mule.mule.model;
12
13 import org.mule.api.model.InvocationResult;
14 import org.mule.model.resolvers.AbstractArgumentEntryPointResolver;
15 import org.mule.model.resolvers.ArrayEntryPointResolver;
16 import org.mule.tck.AbstractMuleTestCase;
17 import org.mule.tck.testmodels.fruit.Apple;
18 import org.mule.tck.testmodels.fruit.Fruit;
19 import org.mule.tck.testmodels.fruit.FruitBowl;
20 import org.mule.tck.testmodels.fruit.Orange;
21
22 public class ArrayEntryPointResolverTestCase extends AbstractMuleTestCase
23 {
24 public void testArrayMatch() throws Exception
25 {
26 AbstractArgumentEntryPointResolver resolver = new ArrayEntryPointResolver();
27 InvocationResult ctx = resolver.invoke(new FruitBowl(), getTestEventContext(new Fruit[]{new Apple(), new Orange()}));
28 assertEquals(ctx.getState(), InvocationResult.State.SUCCESSFUL);
29
30 }
31
32 public void testArrayMatchGenericFail() throws Exception
33 {
34 AbstractArgumentEntryPointResolver resolver = new ArrayEntryPointResolver();
35 InvocationResult ctx = resolver.invoke(new FruitBowl(), getTestEventContext(new Object[]{new Apple(), new Orange()}));
36 assertEquals(ctx.getState(), InvocationResult.State.FAILED);
37 }
38
39
40 public void testArrayMatchFail() throws Exception
41 {
42 AbstractArgumentEntryPointResolver resolver = new ArrayEntryPointResolver();
43 InvocationResult ctx = resolver.invoke(new Apple(), getTestEventContext(new Object[]{"blah"}));
44 assertEquals(ctx.getState(), InvocationResult.State.FAILED);
45 }
46 }