### Question:
NacosServiceDiscovery { public List<String> getServices() throws NacosException { String group = discoveryProperties.getGroup(); ListView<String> services = namingService().getServicesOfServer(1, Integer.MAX_VALUE, group); return services.getData(); } NacosServiceDiscovery(NacosDiscoveryProperties discoveryProperties,
			NacosServiceManager nacosServiceManager); List<ServiceInstance> getInstances(String serviceId); List<String> getServices(); static List<ServiceInstance> hostToServiceInstanceList(
			List<Instance> instances, String serviceId); static ServiceInstance hostToServiceInstance(Instance instance,
			String serviceId);  }### Answer:
@Test public void testGetServices() throws NacosException { ListView<String> nacosServices = new ListView<>(); nacosServices.setData(new LinkedList<>()); nacosServices.getData().add(serviceName + "1"); nacosServices.getData().add(serviceName + "2"); nacosServices.getData().add(serviceName + "3"); NacosDiscoveryProperties nacosDiscoveryProperties = mock( NacosDiscoveryProperties.class); NacosServiceManager nacosServiceManager = mock(NacosServiceManager.class); NamingService namingService = mock(NamingService.class); when(nacosServiceManager .getNamingService(nacosDiscoveryProperties.getNacosProperties())) .thenReturn(namingService); when(nacosDiscoveryProperties.getGroup()).thenReturn("DEFAULT"); when(namingService.getServicesOfServer(eq(1), eq(Integer.MAX_VALUE), eq("DEFAULT"))).thenReturn(nacosServices); NacosServiceDiscovery serviceDiscovery = new NacosServiceDiscovery( nacosDiscoveryProperties, nacosServiceManager); List<String> services = serviceDiscovery.getServices(); assertThat(services.size()).isEqualTo(3); assertThat(services.contains(serviceName + "1")); assertThat(services.contains(serviceName + "2")); assertThat(services.contains(serviceName + "3")); }