@Nullable
    public PasswordAlgorithm forPassword(String hashedPassword) {
        for (PasswordAlgorithm passwordAlgorithm : passwordAlgorithms.values()) {
            if (passwordAlgorithm.supports(hashedPassword))
                return passwordAlgorithm;
        }

        return null;
    }
@Test
    public void testForPasswordShouldReturnNull() throws Exception {
        when(passwordAlgorithm1.supports(anyString())).thenReturn(false);
        when(passwordAlgorithm2.supports(anyString())).thenReturn(false);

        final PasswordAlgorithmFactory passwordAlgorithmFactory = new PasswordAlgorithmFactory(passwordAlgorithms, passwordAlgorithm2);

        assertThat(passwordAlgorithmFactory.forPassword("foobar")).isNull();
    }