use of com.webauthn4j.metadata.legacy.MetadataItemsProvider 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);
}
Aggregations