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.config.spring.parsers;
8   
9   import org.mule.config.spring.parsers.beans.OrphanBean;
10  
11  import org.junit.Test;
12  
13  public class MapCombinerTestCase extends AbstractNamespaceTestCase
14  {
15  
16      @Override
17      protected String getConfigResources()
18      {
19          return "org/mule/config/spring/parsers/map-combiner-test.xml";
20      }
21  
22      @Test
23      public void testProperties()
24      {
25          OrphanBean bean = (OrphanBean) assertBeanExists("checkProps", OrphanBean.class);
26          logger.info("Map size: " + bean.getMap().size());
27          assertMapEntryExists(bean.getMap(), "0", 0);
28      }
29  
30      @Test
31      public void testCombinedMap()
32      {
33          OrphanBean bean = (OrphanBean) assertBeanExists("orphan", OrphanBean.class);
34          logger.info("Map size: " + bean.getMap().size());
35          for (int i = 0; i < 6; ++i)
36          {
37              assertMapEntryExists(bean.getMap(), Integer.toString(i+1), i+1);
38          }
39      }
40  
41      @Test
42      public void testReverersedOrder()
43      {
44          OrphanBean bean = (OrphanBean) assertBeanExists("orphan2", OrphanBean.class);
45          logger.info("Map size: " + bean.getMap().size());
46          for (int i = 0; i < 2; ++i)
47          {
48              assertMapEntryExists(bean.getMap(), Integer.toString(i+1), i+1);
49          }
50      }
51  
52  }