@Test public void discoverManagementServerIps_whenOneIpIsNotPublic() throws Exception { PowerMockito.mockStatic(AddressUtils.class); given(AddressUtils.isPublicAddress("server1Ip")).willReturn(false); given(AddressUtils.isPublicAddress("server2Ip")).willReturn(true); final Date now = new Date(); when(dao.listAll()).thenReturn(Arrays.asList(new ManagementServerHostVO(1l, 1l, "server1Ip", 1, now), new ManagementServerHostVO(2l, 2l, "server2Ip", 2, now))); final Collection<String> ips = new ManagementServerService(dao).discoverManagementServerIps().collect(toList()); assertThat(ips, notNullValue()); assertThat(ips, containsInAnyOrder("localhost", "server2Ip")); }
public Stream<String> discoverManagementServerIps() { return discoverManagementServers().stream().map(getServerPublicIp()).distinct(); }
ManagementServerService { public Stream<String> discoverManagementServerIps() { return discoverManagementServers().stream().map(getServerPublicIp()).distinct(); } }
ManagementServerService { public Stream<String> discoverManagementServerIps() { return discoverManagementServers().stream().map(getServerPublicIp()).distinct(); } @Autowired  ManagementServerService(final ManagementServerHostDao managementServerHostDao); }
ManagementServerService { public Stream<String> discoverManagementServerIps() { return discoverManagementServers().stream().map(getServerPublicIp()).distinct(); } @Autowired  ManagementServerService(final ManagementServerHostDao managementServerHostDao); Stream<String> discoverManagementServerIps(); }
ManagementServerService { public Stream<String> discoverManagementServerIps() { return discoverManagementServers().stream().map(getServerPublicIp()).distinct(); } @Autowired  ManagementServerService(final ManagementServerHostDao managementServerHostDao); Stream<String> discoverManagementServerIps();  }