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.ChildBean;
10  import org.mule.config.spring.parsers.beans.OrphanBean;
11  
12  import org.junit.Test;
13  
14  import static org.junit.Assert.assertEquals;
15  
16  public class ReferenceTestCase extends AbstractNamespaceTestCase
17  {
18  
19      @Override
20      protected String getConfigResources()
21      {
22          return "org/mule/config/spring/parsers/reference-test.xml";
23      }
24  
25      protected void testChildRef(int index)
26      {
27          OrphanBean orphan = (OrphanBean) assertBeanExists("orphan" + index, OrphanBean.class);
28          ChildBean child = (ChildBean) assertContentExists(orphan.getChild(), ChildBean.class);
29          assertEquals("child" + index, child.getName());
30      }
31  
32      @Test
33      public void testNamed()
34      {
35          testChildRef(1);
36      }
37  
38      @Test
39      public void testOrphan()
40      {
41          testChildRef(2);
42      }
43  
44      @Test
45      public void testParent()
46      {
47          testChildRef(3);
48      }
49  
50  }