@Test void provide_test() { MetadataStatementsProvider metadataStatementsProvider = mock(MetadataStatementsProvider.class); AAGUID aaguid = new AAGUID("49e25c43-a6d1-49f0-bcfa-23e23a7c0e52"); when(metadataStatementsProvider.provide()).thenReturn(Collections.singletonMap(aaguid, Collections.singleton(TestDataUtil.createMetadataStatement()))); MetadataStatementsTrustAnchorsProvider metadataStatementsTrustAnchorsProvider = new MetadataStatementsTrustAnchorsProvider(metadataStatementsProvider); Map<AAGUID, Set<TrustAnchor>> result = metadataStatementsTrustAnchorsProvider.provide(); assertThat(result.get(aaguid).stream().map(TrustAnchor::getTrustedCert)).contains(TestAttestationUtil.load3tierTestAuthenticatorAttestationCertificate()); }
@Override public Map<AAGUID, Set<TrustAnchor>> provide() { return metadataStatementsProvider.provide().entrySet().stream() .collect(Collectors.toMap( Map.Entry::getKey, entry -> entry.getValue().stream().flatMap(metadataStatement -> metadataStatement.getAttestationRootCertificates().stream() .map(certificate -> new TrustAnchor(certificate, null)) ).collect(Collectors.toSet()) )); }
MetadataStatementsTrustAnchorsProvider implements TrustAnchorsProvider { @Override public Map<AAGUID, Set<TrustAnchor>> provide() { return metadataStatementsProvider.provide().entrySet().stream() .collect(Collectors.toMap( Map.Entry::getKey, entry -> entry.getValue().stream().flatMap(metadataStatement -> metadataStatement.getAttestationRootCertificates().stream() .map(certificate -> new TrustAnchor(certificate, null)) ).collect(Collectors.toSet()) )); } }
MetadataStatementsTrustAnchorsProvider implements TrustAnchorsProvider { @Override public Map<AAGUID, Set<TrustAnchor>> provide() { return metadataStatementsProvider.provide().entrySet().stream() .collect(Collectors.toMap( Map.Entry::getKey, entry -> entry.getValue().stream().flatMap(metadataStatement -> metadataStatement.getAttestationRootCertificates().stream() .map(certificate -> new TrustAnchor(certificate, null)) ).collect(Collectors.toSet()) )); } MetadataStatementsTrustAnchorsProvider(MetadataStatementsProvider metadataStatementsProvider); }
MetadataStatementsTrustAnchorsProvider implements TrustAnchorsProvider { @Override public Map<AAGUID, Set<TrustAnchor>> provide() { return metadataStatementsProvider.provide().entrySet().stream() .collect(Collectors.toMap( Map.Entry::getKey, entry -> entry.getValue().stream().flatMap(metadataStatement -> metadataStatement.getAttestationRootCertificates().stream() .map(certificate -> new TrustAnchor(certificate, null)) ).collect(Collectors.toSet()) )); } MetadataStatementsTrustAnchorsProvider(MetadataStatementsProvider metadataStatementsProvider); @Override Map<AAGUID, Set<TrustAnchor>> provide(); }
MetadataStatementsTrustAnchorsProvider implements TrustAnchorsProvider { @Override public Map<AAGUID, Set<TrustAnchor>> provide() { return metadataStatementsProvider.provide().entrySet().stream() .collect(Collectors.toMap( Map.Entry::getKey, entry -> entry.getValue().stream().flatMap(metadataStatement -> metadataStatement.getAttestationRootCertificates().stream() .map(certificate -> new TrustAnchor(certificate, null)) ).collect(Collectors.toSet()) )); } MetadataStatementsTrustAnchorsProvider(MetadataStatementsProvider metadataStatementsProvider); @Override Map<AAGUID, Set<TrustAnchor>> provide();  }