Search in sources :

Example 1 with AggregatingMetadataItemsProvider

use of com.webauthn4j.metadata.legacy.AggregatingMetadataItemsProvider in project webauthn4j by webauthn4j.

the class AggregatingMetadataItemsProviderTest method provide_test_common_entry_returned_from_providers.

@Test
void provide_test_common_entry_returned_from_providers() {
    MetadataItem metadataItemA = mock(MetadataItem.class);
    MetadataItem metadataItemB = mock(MetadataItem.class);
    MetadataItemsProvider providerA = mock(MetadataItemsProvider.class);
    Map<AAGUID, Set<MetadataItem>> mapA = new HashMap<>();
    mapA.put(new AAGUID("df495bdc-223a-429d-9f0e-ebfa29155812"), new HashSet<>(Collections.singletonList(metadataItemA)));
    when(providerA.provide()).thenReturn(mapA);
    MetadataItemsProvider providerB = mock(MetadataItemsProvider.class);
    Map<AAGUID, Set<MetadataItem>> mapB = new HashMap<>();
    mapB.put(new AAGUID("df495bdc-223a-429d-9f0e-ebfa29155812"), new HashSet<>(Arrays.asList(metadataItemA, metadataItemB)));
    when(providerB.provide()).thenReturn(mapB);
    MetadataItemsProvider target = new AggregatingMetadataItemsProvider(Arrays.asList(providerA, providerB));
    assertThat(target.provide().keySet()).containsExactly(new AAGUID("df495bdc-223a-429d-9f0e-ebfa29155812"));
    assertThat(target.provide().get(new AAGUID("df495bdc-223a-429d-9f0e-ebfa29155812"))).containsExactlyInAnyOrder(metadataItemA, metadataItemB);
}
Also used : MetadataItemsProvider(com.webauthn4j.metadata.legacy.MetadataItemsProvider) AggregatingMetadataItemsProvider(com.webauthn4j.metadata.legacy.AggregatingMetadataItemsProvider) AAGUID(com.webauthn4j.data.attestation.authenticator.AAGUID) AggregatingMetadataItemsProvider(com.webauthn4j.metadata.legacy.AggregatingMetadataItemsProvider) MetadataItem(com.webauthn4j.metadata.legacy.data.MetadataItem) Test(org.junit.jupiter.api.Test)

Aggregations

AAGUID (com.webauthn4j.data.attestation.authenticator.AAGUID)1 AggregatingMetadataItemsProvider (com.webauthn4j.metadata.legacy.AggregatingMetadataItemsProvider)1 MetadataItemsProvider (com.webauthn4j.metadata.legacy.MetadataItemsProvider)1 MetadataItem (com.webauthn4j.metadata.legacy.data.MetadataItem)1 Test (org.junit.jupiter.api.Test)1