JsonFileResourceMetadataStatementsProvider implements MetadataStatementsProvider, InitializingBean { AAGUID extractAAGUID(MetadataStatement metadataStatement) { switch (metadataStatement.getProtocolFamily()) { case "fido2": return metadataStatement.getAaguid(); case "u2f": return AAGUID.ZERO; case "uaf": default: return AAGUID.NULL; } } JsonFileResourceMetadataStatementsProvider(ObjectConverter objectConverter); @Override void afterPropertiesSet(); @Override Map<AAGUID, Set<MetadataStatement>> provide(); List<Resource> getResources(); void setResources(List<Resource> resources);  }
@Test public void extractAAGUID_with_fido2_test() { AAGUID aaguid = new AAGUID(UUID.randomUUID()); MetadataStatement metadataStatement = mock(MetadataStatement.class); when(metadataStatement.getProtocolFamily()).thenReturn("fido2"); when(metadataStatement.getAaguid()).thenReturn(aaguid); assertThat(target.extractAAGUID(metadataStatement)).isEqualTo(aaguid); }
@Test public void extractAAGUID_with_u2f_test() { MetadataStatement metadataStatement = mock(MetadataStatement.class); when(metadataStatement.getProtocolFamily()).thenReturn("u2f"); assertThat(target.extractAAGUID(metadataStatement)).isEqualTo(AAGUID.ZERO); }
@Test public void extractAAGUID_with_uaf_test() { MetadataStatement metadataStatement = mock(MetadataStatement.class); when(metadataStatement.getProtocolFamily()).thenReturn("uaf"); assertThat(target.extractAAGUID(metadataStatement)).isEqualTo(AAGUID.NULL); }