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