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