Added a couple more tests.

This commit is contained in:
Luke Taylor 2006-04-16 21:18:12 +00:00
parent 7a0a87a167
commit f61a58d98b
1 changed files with 11 additions and 0 deletions

View File

@ -36,6 +36,10 @@ public class LdapShaPasswordEncoderTests extends TestCase {
assertTrue(sha.isPasswordValid("{SHA}ddSFGmjXYPbZC+NXR2kCzBRjqiE=", "boabspasswurd", null));
}
public void testInvalidPasswordFails() {
assertFalse(sha.isPasswordValid("{SHA}ddSFGmjXYPbZC+NXR2kCzBRjqiE=", "wrongpassword", null));
}
/** Test values generated by 'slappasswd -s boabspasswurd' */
public void testValidSaltedPasswordSucceeds() {
assertTrue(sha.isPasswordValid("{SSHA}25ro4PKC8jhQZ26jVsozhX/xaP0suHgX", "boabspasswurd", null));
@ -46,4 +50,11 @@ public class LdapShaPasswordEncoderTests extends TestCase {
assertFalse(sha.isPasswordValid("{SSHA}25ro4PKC8jhQZ26jVsozhX/xaP0suHgX", "wrongpassword", null));
assertFalse(sha.isPasswordValid("{SSHA}PQy2j+6n5ytA+YlAKkM8Fh4p6u2JxfVd", "wrongpassword", null));
}
public void testNonByteArraySaltThrowsException() {
try {
sha.encodePassword("password", "AStringNotAByteArray");
} catch(IllegalArgumentException expected) {
}
}
}