TrustAnchor extends Base<TrustAnchor> { public List<URI> getLocationsByPreference() { return locations.stream() .map(URI::create) .sorted(Comparator.comparing(URI::getScheme)) .collect(Collectors.toList()); } TrustAnchor();  TrustAnchor(boolean preconfigured); void setCertificate(X509ResourceCertificate certificate); X509ResourceCertificate getCertificate(); void markInitialCertificateTreeValidationRunCompleted(); List<URI> getLocationsByPreference(); static final String TYPE; }
@Test public void getLocationsByPreference_prefers_https_over_rsync() { TrustAnchor ta = new TrustAnchor(); ta.setLocations(Lists.newArrayList("rsync: assertThat(ta.getLocationsByPreference()).containsExactly( URI.create("https: URI.create("rsync: ); }
@Test public void getLocationsByPreference_keeps_order_within_protocol() { TrustAnchor ta = new TrustAnchor(); ta.setLocations(Lists.newArrayList("rsync: assertThat(ta.getLocationsByPreference()).containsExactly( URI.create("https: URI.create("rsync: URI.create("rsync: ); ta.setLocations(Lists.newArrayList("rsync: assertThat(ta.getLocationsByPreference()).containsExactly( URI.create("https: URI.create("rsync: URI.create("rsync: ); }
@Test public void getLocationsByPreference_handles_empty() { TrustAnchor ta = new TrustAnchor(); ta.setLocations(Lists.newArrayList()); assertThat(ta.getLocationsByPreference()).isEmpty(); }