View Javadoc

1   /*
2    * $Id: BeanCreationExceptionPropagationTestCase.java 19191 2010-08-25 21:05:23Z tcarlson $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  package org.mule.config.spring;
11  
12  import org.mule.api.MuleRuntimeException;
13  import org.mule.tck.FunctionalTestCase;
14  
15  import org.springframework.beans.FatalBeanException;
16  
17  public class BeanCreationExceptionPropagationTestCase extends FunctionalTestCase
18  {
19      protected String getConfigResources()
20      {
21          return "org/mule/config/spring/bean-creation-exception-propagation-config.xml";
22      }
23  
24      @Override
25      protected boolean isStartContext()
26      {
27          // need to start it ourselves and catch the exception
28          return false;
29      }
30  
31      public void testBeanCreationExceptionPropagation()
32      {
33          // lookup all objects
34          try
35          {
36              muleContext.getRegistry().lookupObjects(Object.class);
37              fail("Should've failed with an exception");
38          }
39          catch (MuleRuntimeException e)
40          {
41              Throwable t = e.getCause();
42              assertNotNull(t);
43              assertTrue(t instanceof FatalBeanException);
44          }
45      }
46  }