@Test public void testFactory() throws Exception { final DnsResolver resolver = mock(DnsResolver.class); when(resolver.resolve("example.com")).thenReturn(IPS_1); when(resolver.resolve("example.net")).thenReturn(IPS_2); final List<Endpoint> endpoints = Endpoints.of(uris, resolver); assertThat(endpoints.size(), equalTo(4)); assertThat(endpoints.get(0).getUri(), equalTo(uri1)); assertThat(endpoints.get(0).getIp(), equalTo(IP_A)); assertThat(endpoints.get(1).getUri(), equalTo(uri1)); assertThat(endpoints.get(1).getIp(), equalTo(IP_B)); assertThat(endpoints.get(2).getUri(), equalTo(uri2)); assertThat(endpoints.get(2).getIp(), equalTo(IP_C)); assertThat(endpoints.get(3).getUri(), equalTo(uri2)); assertThat(endpoints.get(3).getIp(), equalTo(IP_D)); }
public static Supplier<List<Endpoint>> of(final Supplier<List<URI>> uriSupplier) { return of(uriSupplier, DEFAULT_DNS_RESOLVER); }
Endpoints { public static Supplier<List<Endpoint>> of(final Supplier<List<URI>> uriSupplier) { return of(uriSupplier, DEFAULT_DNS_RESOLVER); } }
Endpoints { public static Supplier<List<Endpoint>> of(final Supplier<List<URI>> uriSupplier) { return of(uriSupplier, DEFAULT_DNS_RESOLVER); } private  Endpoints(); }
Endpoints { public static Supplier<List<Endpoint>> of(final Supplier<List<URI>> uriSupplier) { return of(uriSupplier, DEFAULT_DNS_RESOLVER); } private  Endpoints(); static Supplier<List<Endpoint>> of(final Supplier<List<URI>> uriSupplier); static List<Endpoint> of(final List<URI> uris); }
Endpoints { public static Supplier<List<Endpoint>> of(final Supplier<List<URI>> uriSupplier) { return of(uriSupplier, DEFAULT_DNS_RESOLVER); } private  Endpoints(); static Supplier<List<Endpoint>> of(final Supplier<List<URI>> uriSupplier); static List<Endpoint> of(final List<URI> uris);  }