use of org.mule.runtime.core.internal.lifecycle.MuleContextLifecycleManager in project mule by mulesoft.
the class DefaultMuleContextTestCase method callDisposeIfInitFails.
@Test
public void callDisposeIfInitFails() throws Exception {
ServerNotificationManager mockNotificationManager = mock(ServerNotificationManager.class);
doThrow(MuleRuntimeException.class).when(mockNotificationManager).initialise();
DefaultMuleContextBuilder muleContextBuilder = new DefaultMuleContextBuilder(APP);
muleContextBuilder.setLifecycleManager(new MuleContextLifecycleManager());
muleContextBuilder.setNotificationManager(mockNotificationManager);
DefaultMuleContext defaultMuleContext = (DefaultMuleContext) muleContextBuilder.buildMuleContext();
try {
defaultMuleContext.initialise();
fail("exception expected");
} catch (Exception e) {
verify(mockNotificationManager).dispose();
}
}
Aggregations