@Override
    public boolean matches(String hashedPassword, String otherPassword) {
        if (supports(hashedPassword)) {
            return hash(otherPassword).equals(hashedPassword);
        } else {
            throw new IllegalArgumentException("Supplied hashed password is not supported.");
        }
    }
@Test
    public void testMatches() throws Exception {
        assertThat(SHA1HashPasswordAlgorithm.matches("baae906e6bbb37ca5033600fcb4824c98b0430fb", "foobar")).isTrue();
    }