@Test
 public void getBeanIfAvailable_applicationThrowsUnrelatedException_exceptionPropagatedAsIs() {
   RuntimeException expectedException = new RuntimeException();
   when(context.getBean(ConfigTestBean.class)).thenThrow(expectedException);
   exceptionExpectation.expect(is(expectedException));
   SpringContextUtils.getBeanIfAvailable(context, ConfigTestBean.class);
 }
 @Test
 public void getBeanIfAvailable_beanNotAvailable_nullReturned() {
   when(context.getBean(ConfigTestBean.class))
       .thenThrow(new NoSuchBeanDefinitionException(ConfigTestBean.class));
   ConfigTestBean actualBean =
       SpringContextUtils.getBeanIfAvailable(context, ConfigTestBean.class);
   assertThat(actualBean, is(nullValue()));
 }
 @Test
 public void getBeanIfAvailable_beanAvailable_beanReturned() {
   ConfigTestBean expectedBean = new ConfigTestBean();
   when(context.getBean(ConfigTestBean.class)).thenReturn(expectedBean);
   ConfigTestBean actualBean =
       SpringContextUtils.getBeanIfAvailable(context, ConfigTestBean.class);
   assertThat(actualBean, is(expectedBean));
 }