View Javadoc

1   /*
2    * $Id: ArrayEntryPointResolverTestCase.java 20321 2010-11-24 15:21:24Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.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      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  }