View Javadoc

1   /*
2    * $Id: BeanCreationExceptionPropagationTestCase.java 19692 2010-09-21 23:50:35Z aperepel $
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  
11  package org.mule.config.spring;
12  
13  import org.mule.api.MuleRuntimeException;
14  import org.mule.tck.FunctionalTestCase;
15  
16  import org.springframework.beans.FatalBeanException;
17  
18  public class BeanCreationExceptionPropagationTestCase extends FunctionalTestCase
19  {
20      protected String getConfigResources()
21      {
22          return "org/mule/config/spring/bean-creation-exception-propagation-config.xml";
23      }
24  
25      @Override
26      protected boolean isStartContext()
27      {
28          // need to start it ourselves and catch the exception
29          return false;
30      }
31  
32      public void testBeanCreationExceptionPropagation()
33      {
34          // lookup all objects
35          try
36          {
37              muleContext.getRegistry().lookupObjects(Object.class);
38              fail("Should've failed with an exception");
39          }
40          catch (MuleRuntimeException e)
41          {
42              Throwable t = e.getCause();
43              assertNotNull(t);
44              assertTrue(t instanceof FatalBeanException);
45          }
46      }
47  }