@Test public void getServices(@Injectable ServiceCombClient serviceCombClient, @Injectable ServiceCombDiscoveryProperties serviceCombDiscoveryProperties) throws ServiceCombException { MicroserviceResponse microserviceResponse = new MicroserviceResponse(); Microservice microservice = new Microservice(); microservice.setServiceName("test"); List<Microservice> microserviceList = new ArrayList<>(); microserviceList.add(microservice); microserviceResponse.setServices(microserviceList); new Expectations() { { serviceCombClient.getServices(); result = microserviceResponse; } }; ServiceCombDiscoveryClient serviceCombDiscoveryClient = new ServiceCombDiscoveryClient( serviceCombDiscoveryProperties, serviceCombClient); List<String> actual = serviceCombDiscoveryClient.getServices(); Assert.assertEquals(actual.size(), 1); }
@Override public List<String> getServices() { List<String> serviceList = new ArrayList<>(); try { MicroserviceResponse microServiceResponse = serviceCombClient .getServices(); if (microServiceResponse == null || microServiceResponse.getServices() == null) { return serviceList; } for (Microservice microservice : microServiceResponse.getServices()) { serviceList.add(microservice.getServiceName()); } return serviceList; } catch (ServiceCombException e) { LOGGER.error("getServices failed", e); } return serviceList; }
ServiceCombDiscoveryClient implements DiscoveryClient { @Override public List<String> getServices() { List<String> serviceList = new ArrayList<>(); try { MicroserviceResponse microServiceResponse = serviceCombClient .getServices(); if (microServiceResponse == null || microServiceResponse.getServices() == null) { return serviceList; } for (Microservice microservice : microServiceResponse.getServices()) { serviceList.add(microservice.getServiceName()); } return serviceList; } catch (ServiceCombException e) { LOGGER.error("getServices failed", e); } return serviceList; } }
ServiceCombDiscoveryClient implements DiscoveryClient { @Override public List<String> getServices() { List<String> serviceList = new ArrayList<>(); try { MicroserviceResponse microServiceResponse = serviceCombClient .getServices(); if (microServiceResponse == null || microServiceResponse.getServices() == null) { return serviceList; } for (Microservice microservice : microServiceResponse.getServices()) { serviceList.add(microservice.getServiceName()); } return serviceList; } catch (ServiceCombException e) { LOGGER.error("getServices failed", e); } return serviceList; } ServiceCombDiscoveryClient(ServiceCombDiscoveryProperties discoveryProperties,
      ServiceCombClient serviceCombClient); }
ServiceCombDiscoveryClient implements DiscoveryClient { @Override public List<String> getServices() { List<String> serviceList = new ArrayList<>(); try { MicroserviceResponse microServiceResponse = serviceCombClient .getServices(); if (microServiceResponse == null || microServiceResponse.getServices() == null) { return serviceList; } for (Microservice microservice : microServiceResponse.getServices()) { serviceList.add(microservice.getServiceName()); } return serviceList; } catch (ServiceCombException e) { LOGGER.error("getServices failed", e); } return serviceList; } ServiceCombDiscoveryClient(ServiceCombDiscoveryProperties discoveryProperties,
      ServiceCombClient serviceCombClient); @Override String description(); @Override List<ServiceInstance> getInstances(String serviceId); @Override List<String> getServices(); }
ServiceCombDiscoveryClient implements DiscoveryClient { @Override public List<String> getServices() { List<String> serviceList = new ArrayList<>(); try { MicroserviceResponse microServiceResponse = serviceCombClient .getServices(); if (microServiceResponse == null || microServiceResponse.getServices() == null) { return serviceList; } for (Microservice microservice : microServiceResponse.getServices()) { serviceList.add(microservice.getServiceName()); } return serviceList; } catch (ServiceCombException e) { LOGGER.error("getServices failed", e); } return serviceList; } ServiceCombDiscoveryClient(ServiceCombDiscoveryProperties discoveryProperties,
      ServiceCombClient serviceCombClient); @Override String description(); @Override List<ServiceInstance> getInstances(String serviceId); @Override List<String> getServices();  }