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.util;
8   
9   import org.mule.tck.junit4.AbstractMuleTestCase;
10  import org.mule.tck.testmodels.fruit.Apple;
11  import org.mule.tck.testmodels.fruit.Banana;
12  import org.mule.tck.testmodels.fruit.Fruit;
13  import org.mule.tck.testmodels.fruit.WaterMelon;
14  
15  import java.util.ArrayList;
16  import java.util.List;
17  
18  import org.junit.Test;
19  
20  import static org.junit.Assert.assertTrue;
21  
22  public class MulticasterTestCase extends AbstractMuleTestCase
23  {
24  
25      @Test
26      public void testMulticating() throws Exception
27      {
28          List fruit = new ArrayList();
29          Apple apple = new Apple();
30          Banana banana = new Banana();
31          WaterMelon melon = new WaterMelon();
32          fruit.add(apple);
33          fruit.add(banana);
34          fruit.add(melon);
35  
36          Fruit caster = (Fruit)Multicaster.create(Fruit.class, fruit);
37          caster.bite();
38  
39          assertTrue(apple.isBitten());
40          assertTrue(banana.isBitten());
41          assertTrue(melon.isBitten());
42      }
43  
44  }