@Test public void testWeakPasswords() { PasswordStrengthEstimator e = new PasswordStrengthEstimatorImpl(); assertTrue(e.estimateStrength("") == NONE); assertTrue(e.estimateStrength("password") < QUITE_STRONG); assertTrue(e.estimateStrength("letmein") < QUITE_STRONG); assertTrue(e.estimateStrength("123456") < QUITE_STRONG); }
@Override public float estimateStrength(String password) { HashSet<Character> unique = new HashSet<>(); int length = password.length(); for (int i = 0; i < length; i++) unique.add(password.charAt(i)); return Math.min(1, (float) unique.size() / STRONG_UNIQUE_CHARS); }
PasswordStrengthEstimatorImpl implements PasswordStrengthEstimator { @Override public float estimateStrength(String password) { HashSet<Character> unique = new HashSet<>(); int length = password.length(); for (int i = 0; i < length; i++) unique.add(password.charAt(i)); return Math.min(1, (float) unique.size() / STRONG_UNIQUE_CHARS); } }
PasswordStrengthEstimatorImpl implements PasswordStrengthEstimator { @Override public float estimateStrength(String password) { HashSet<Character> unique = new HashSet<>(); int length = password.length(); for (int i = 0; i < length; i++) unique.add(password.charAt(i)); return Math.min(1, (float) unique.size() / STRONG_UNIQUE_CHARS); }  }
PasswordStrengthEstimatorImpl implements PasswordStrengthEstimator { @Override public float estimateStrength(String password) { HashSet<Character> unique = new HashSet<>(); int length = password.length(); for (int i = 0; i < length; i++) unique.add(password.charAt(i)); return Math.min(1, (float) unique.size() / STRONG_UNIQUE_CHARS); }  @Override float estimateStrength(String password); }
PasswordStrengthEstimatorImpl implements PasswordStrengthEstimator { @Override public float estimateStrength(String password) { HashSet<Character> unique = new HashSet<>(); int length = password.length(); for (int i = 0; i < length; i++) unique.add(password.charAt(i)); return Math.min(1, (float) unique.size() / STRONG_UNIQUE_CHARS); }  @Override float estimateStrength(String password);  }