PasswordUtil { public static boolean isPlainTextPassword(@Nullable String password) { return extractAlgorithm(password) == null; } private  PasswordUtil(); static String buildPasswordHash(@NotNull String password); static String buildPasswordHash(@NotNull String password,
                                           @Nullable String algorithm,
                                           int saltSize, int iterations); static String buildPasswordHash(@NotNull String password,
                                           @NotNull ConfigurationParameters config); static boolean isPlainTextPassword(@Nullable String password); static boolean isSame(@Nullable String hashedPassword, @NotNull char[] password); static boolean isSame(@Nullable String hashedPassword, @NotNull String password); static final String DEFAULT_ALGORITHM; static final int DEFAULT_SALT_SIZE; static final int DEFAULT_ITERATIONS; }
@Test public void testIsPlainTextPassword() { for (String pw : plainPasswords) { assertTrue(pw + " should be plain text.", PasswordUtil.isPlainTextPassword(pw)); } }
@Test public void testIsPlainTextForNull() { assertTrue(PasswordUtil.isPlainTextPassword(null)); }
@Test public void testIsPlainTextForPwHash() { for (String pwHash : hashedPasswords.values()) { assertFalse(pwHash + " should not be plain text.", PasswordUtil.isPlainTextPassword(pwHash)); } }