use of org.mule.runtime.api.notification.NotificationListener in project mule by mulesoft.
the class ServerNotificationsTestCase method testAsyncNotificationRejectedExecution.
@Test
public void testAsyncNotificationRejectedExecution() {
MuleContext muleContext = mock(MuleContext.class);
SchedulerService schedulerService = mock(SchedulerService.class);
Scheduler scheduler = mock(Scheduler.class);
when(muleContext.getSchedulerService()).thenReturn(schedulerService);
when(schedulerService.cpuLightScheduler()).thenReturn(scheduler);
when(scheduler.submit(any(Callable.class))).thenThrow(new RejectedExecutionException());
Notification notification = mock(CustomNotification.class);
when(notification.isSynchronous()).thenReturn(false);
NotificationListener notificationListener = mock(CustomNotificationListener.class);
ServerNotificationManager manager = new ServerNotificationManager();
manager.setMuleContext(muleContext);
manager.addInterfaceToType(CustomNotificationListener.class, CustomNotification.class);
manager.addListener(notificationListener);
manager.fireNotification(notification);
verify(notificationListener, never()).onNotification(notification);
}
Aggregations