1
2
3
4
5
6
7
8
9
10
11 package org.mule.config.spring.parsers;
12
13 import org.mule.config.spring.parsers.beans.AbstractBean;
14 import org.mule.config.spring.parsers.beans.ChildBean;
15 import org.mule.config.spring.parsers.beans.OrphanBean;
16
17 import org.junit.Test;
18
19 import static org.junit.Assert.assertEquals;
20 import static org.junit.Assert.assertNotNull;
21
22 public class AliasTestCase extends AbstractNamespaceTestCase
23 {
24
25 @Override
26 protected String getConfigResources()
27 {
28 return "org/mule/config/spring/parsers/alias-test.xml";
29 }
30
31 protected void assertFooExists(int index)
32 {
33 OrphanBean orphan = (OrphanBean) assertBeanExists("orphan" + index, OrphanBean.class);
34 assertFooExists(orphan, 10 * index + 1);
35 ChildBean child = (ChildBean) assertContentExists(orphan.getChild(), ChildBean.class);
36 assertFooExists(child, 10 * index + 2);
37 }
38
39 protected void assertFooExists(AbstractBean bean, int value)
40 {
41 assertNotNull(bean);
42 assertEquals(value, bean.getFoo());
43 }
44
45 @Test
46 public void testNamed()
47 {
48 assertFooExists(1);
49 }
50
51 @Test
52 public void testOrphan()
53 {
54 assertFooExists(2);
55 }
56
57 @Test
58 public void testParent()
59 {
60 assertFooExists(3);
61 }
62
63 }