1
2
3
4
5
6
7
8
9
10
11 package org.mule.config.spring;
12
13 import org.mule.api.MuleRuntimeException;
14 import org.mule.tck.junit4.FunctionalTestCase;
15
16 import org.junit.Test;
17 import org.springframework.beans.FatalBeanException;
18
19 import static org.junit.Assert.assertNotNull;
20 import static org.junit.Assert.assertTrue;
21 import static org.junit.Assert.fail;
22
23 public class BeanCreationExceptionPropagationTestCase extends FunctionalTestCase
24 {
25
26 @Override
27 protected String getConfigResources()
28 {
29 return "org/mule/config/spring/bean-creation-exception-propagation-config.xml";
30 }
31
32 @Override
33 protected boolean isStartContext()
34 {
35
36 return false;
37 }
38
39 @Test
40 public void testBeanCreationExceptionPropagation()
41 {
42
43 try
44 {
45 muleContext.getRegistry().lookupObjects(Object.class);
46 fail("Should've failed with an exception");
47 }
48 catch (MuleRuntimeException e)
49 {
50 Throwable t = e.getCause();
51 assertNotNull(t);
52 assertTrue(t instanceof FatalBeanException);
53 }
54 }
55 }