TrustAnchorsResolverImpl implements TrustAnchorsResolver { @Override public Set<TrustAnchor> resolve(AAGUID aaguid) { AssertUtil.notNull(aaguid, "aaguid must not be null"); Map<AAGUID, Set<TrustAnchor>> trustAnchors = trustAnchorsProvider.provide(); HashSet<TrustAnchor> set = new HashSet<>(); set.addAll(trustAnchors.getOrDefault(AAGUID.NULL, Collections.emptySet())); set.addAll(trustAnchors.getOrDefault(aaguid, Collections.emptySet())); return set; } TrustAnchorsResolverImpl(TrustAnchorsProvider trustAnchorsProvider); @Override Set<TrustAnchor> resolve(AAGUID aaguid);  }
@Test void test() { TrustAnchorsResolverImpl target = new TrustAnchorsResolverImpl(new SampleTrustAnchorsProvider()); Set<TrustAnchor> trustAnchorsA = target.resolve(AAGUID.ZERO); Set<TrustAnchor> trustAnchorsB = target.resolve(AAGUID.ZERO); assertThat(trustAnchorsA).isEqualTo(trustAnchorsB); }