### Question:
ConsulRegistryServiceImpl implements RegistryService<ConsulListener> { @Override public void subscribe(String cluster, ConsulListener listener) throws Exception { listenerMap.putIfAbsent(cluster, new HashSet<>()); listenerMap.get(cluster).add(listener); Response<List<HealthService>> response = getHealthyServices(cluster, -1, DEFAULT_WATCH_TIMEOUT); Long index = response.getConsulIndex(); ConsulNotifier notifier = notifiers.computeIfAbsent(cluster, k -> new ConsulNotifier(cluster, index)); notifierExecutor.submit(notifier); } private  ConsulRegistryServiceImpl(); @Override void register(InetSocketAddress address); @Override void unregister(InetSocketAddress address); @Override void subscribe(String cluster, ConsulListener listener); @Override void unsubscribe(String cluster, ConsulListener listener); @Override List<InetSocketAddress> lookup(String key); @Override void close();  }### Answer:
@Test public void testSubscribe() throws Exception { RegistryService registryService = mock(ConsulRegistryServiceImpl.class); ConsulListener consulListener = mock(ConsulListener.class); registryService.subscribe("test", consulListener); verify(registryService).subscribe("test", consulListener); }