mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 03:39:05 +01:00
30 lines
992 B
Java
30 lines
992 B
Java
package org.briarproject.crypto;
|
|
|
|
import org.briarproject.BriarTestCase;
|
|
import org.briarproject.api.crypto.PasswordStrengthEstimator;
|
|
import org.junit.Test;
|
|
|
|
import static org.briarproject.api.crypto.PasswordStrengthEstimator.QUITE_STRONG;
|
|
import static org.junit.Assert.assertTrue;
|
|
|
|
public class PasswordStrengthEstimatorImplTest extends BriarTestCase {
|
|
|
|
@Test
|
|
public void testWeakPasswords() {
|
|
PasswordStrengthEstimator e = new PasswordStrengthEstimatorImpl();
|
|
assertTrue(e.estimateStrength("") < QUITE_STRONG);
|
|
assertTrue(e.estimateStrength("password") < QUITE_STRONG);
|
|
assertTrue(e.estimateStrength("letmein") < QUITE_STRONG);
|
|
assertTrue(e.estimateStrength("123456") < QUITE_STRONG);
|
|
}
|
|
|
|
@Test
|
|
public void testStrongPasswords() {
|
|
PasswordStrengthEstimator e = new PasswordStrengthEstimatorImpl();
|
|
// Industry standard
|
|
assertTrue(e.estimateStrength("Tr0ub4dor&3") > QUITE_STRONG);
|
|
assertTrue(e.estimateStrength("correcthorsebatterystaple")
|
|
> QUITE_STRONG);
|
|
}
|
|
}
|