LeaderRecordWatcher implements Watcher<ConfigMap> { @Override public void onClose(KubernetesClientException cause) { if (cause != null) { synchronized (this.lock) { LOGGER.warn("Watcher stopped unexpectedly, will restart", cause); this.watch = null; start(); } } } 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 shouldHandleClose() { initStubs(); this.watcher.onClose(this.mockKubernetesClientException); verify(this.mockWithNameResource).watch(this.watcher); }
@Test public void shouldIgnoreCloseWithoutCause() { this.watcher.onClose(null); verify(this.mockWithNameResource, times(0)).watch(this.watcher); }