public static void addSecurityProvider(Properties properties) {
        properties.keySet().stream()
                .filter(key -> key.toString().matches("security\\.provider(\\.\\d+)?"))
                .sorted(Comparator.comparing(String::valueOf)).forEach(key -> addSecurityProvider(properties.get(key).toString()));
    }
@Test
    void addSecurityProvidersViaProperties() {
        removeAllDummyProviders();
        int providersCountBefore = Security.getProviders().length;

        Properties properties = new Properties();
        properties.put("security.provider.1", DummyProviderWithConfig.class.getName() + ":2:CONFIG");
        properties.put("security.provider", DummyProvider.class.getName() + ":1");

        SecurityProviderLoader.addSecurityProvider(properties);

        Provider[] providersAfter = Security.getProviders();
        assertEquals(providersCountBefore + 2, providersAfter.length);

        Provider provider = Security.getProvider(DummyProvider.PROVIDER_NAME);
        Provider providerWithConfig = Security.getProvider(DummyProviderWithConfig.PROVIDER_NAME);

        assertNotNull(provider, "Provider not installed.");
        assertEquals(DummyProvider.class, provider.getClass());
        assertEquals(provider, providersAfter[0]);

        assertNotNull(providerWithConfig, "Provider not installed.");
        assertEquals(DummyProviderWithConfig.class, providerWithConfig.getClass());
        assertEquals(providerWithConfig, providersAfter[1]);
        assertEquals("CONFIG", ((DummyProviderWithConfig) providerWithConfig).getConfig());
    }