NotificationServiceImpl implements NotificationService { @Override public Notifier remove(String notifierName) { LOG.info("De-registering notifier {}", notifierName); Notifier notifier = notifiers.remove(notifierName); if (notifier != null) { LOG.info("Closing notifier {}", notifierName); notifier.close(); } return notifier; } NotificationServiceImpl();  NotificationServiceImpl(NotificationStore store);  NotificationServiceImpl(Map<String, Object> config);  NotificationServiceImpl(Map<String, Object> config, NotificationStore store); @Override Notifier register(String notifierName, NotificationContext ctx); @Override Notifier remove(String notifierName); @Override Future<?> notify(String notifierName, Notification notification); @Override Notification getNotification(String notificationId); @Override List<Notification> getNotifications(List<String> notificationIds); @Override List<Notification> findNotifications(List<QueryParam> queryParams); @Override StreamlineEvent getEvent(String eventId); @Override List<StreamlineEvent> getEvents(List<String> eventIds); @Override Notification updateNotificationStatus(String notificationId, Notification.Status status); @Override void close();  }
@Test public void testRemove() throws Exception { new Expectations() { { mockCtx.getConfig(); times = 3; result = mockNotifierConfig; mockNotifierConfig.getClassName(); times = 1; result = "Test"; mockNotifierConfig.getJarPath(); times = 1; result = "/tmp/test.jar"; mockProxyUtil.loadClassFromJar("/tmp/test.jar", "Test"); result = mockNotifier; } }; notificationService.register("test_notifier", mockCtx); Notifier result = notificationService.remove("test_notifier"); assertEquals(mockNotifier, result); new Verifications() { { mockNotifier.close(); times = 1; } }; result = notificationService.remove("test_notifier"); assertEquals(null, result); }