ClusterPathChildrenCacheListener implements PathChildrenCacheListener { @Override public void childEvent(CuratorFramework client, PathChildrenCacheEvent event) throws Exception { String node; String nodeId; try { node = ZKPaths.getNodeFromPath(event.getData().getPath()); nodeId = node.substring(node.indexOf("_") + 1); clusterSyncManagerInstance.updateNodeStatus(nodeId, event.getType()); }catch (Exception e){ logger.error("Exception receiving event {}: {}", event, e.getMessage()); } } ClusterPathChildrenCacheListener(ClusterSyncManager clusterSyncManagerInstance); @Override void childEvent(CuratorFramework client, PathChildrenCacheEvent event);  }
@Test public void childEventTest() throws Exception { ClusterPathChildrenCacheListener listener = new ClusterPathChildrenCacheListener(clusterSyncManager); CuratorFramework client = mock(CuratorFramework.class); PathChildrenCacheEvent event = mock(PathChildrenCacheEvent.class, Mockito.RETURNS_DEEP_STUBS); when(event.getData().getPath()).thenReturn("/stratio/decision/group_group1"); listener.childEvent(client, event); }