1   /*
2    * $Id: ArrayEntryPointResolverTestCase.java 10489 2008-01-23 17:53:38Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
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  
25      public void testArrayMatch() throws Exception
26      {
27          AbstractArgumentEntryPointResolver resolver = new ArrayEntryPointResolver();
28          InvocationResult ctx = resolver.invoke(new FruitBowl(), getTestEventContext(new Fruit[]{new Apple(), new Orange()}));
29          assertEquals(ctx.getState(), InvocationResult.STATE_INVOKED_SUCESSFUL);
30  
31      }
32  
33      public void testArrayMatchGenericFail() throws Exception
34      {
35          AbstractArgumentEntryPointResolver resolver = new ArrayEntryPointResolver();
36          InvocationResult ctx = resolver.invoke(new FruitBowl(), getTestEventContext(new Object[]{new Apple(), new Orange()}));
37          assertEquals(ctx.getState(), InvocationResult.STATE_INVOKED_FAILED);
38      }
39  
40  
41      public void testArrayMatchFail() throws Exception
42      {
43          AbstractArgumentEntryPointResolver resolver = new ArrayEntryPointResolver();
44          InvocationResult ctx = resolver.invoke(new Apple(), getTestEventContext(new Object[]{"blah"}));
45          assertEquals(ctx.getState(), InvocationResult.STATE_INVOKED_FAILED);
46      }
47  }