LeaderRecordWatcher implements Watcher<ConfigMap> { @Override public void eventReceived(Action action, ConfigMap configMap) { LOGGER.debug("'{}' event received, triggering leadership update", action); if (!Action.ERROR.equals(action)) { this.leadershipController.update(); } } LeaderRecordWatcher(LeaderProperties leaderProperties, LeadershipController leadershipController,
			KubernetesClient kubernetesClient); void start(); void stop(); @Override void eventReceived(Action action, ConfigMap configMap); @Override void onClose(KubernetesClientException cause);  }
@Test public void shouldHandleEvent() { this.watcher.eventReceived(Watcher.Action.ADDED, this.mockConfigMap); this.watcher.eventReceived(Watcher.Action.DELETED, this.mockConfigMap); this.watcher.eventReceived(Watcher.Action.MODIFIED, this.mockConfigMap); verify(this.mockLeadershipController, times(3)).update(); }
@Test public void shouldIgnoreErrorEvent() { this.watcher.eventReceived(Watcher.Action.ERROR, this.mockConfigMap); verify(this.mockLeadershipController, times(0)).update(); }