PasswordUtils { public static String addSalt(String origin, String salt) { Pattern p = Pattern.compile("\\d{2}:\\d{2}:\\d{2}"); Matcher m = p.matcher(salt); if (m.find() != true) assert (false); return origin + revertString(m.group().replaceFirst(":", "-")); }  static String createPassword(String rawPass, String salt); static boolean isPasswordValid(String encPass, String rawPass, String salt); static String updateOldEncPass(String oldPW, String salt); static BCryptPasswordEncoder getBcryptDigestByLevel(int level); static String addSalt(String origin, String salt); static final PasswordEncoder encoder; static final BCryptPasswordEncoder digester; }
@Test public void testAddSalt() { String result = PasswordUtils.addSalt(STRING, DATESTRING); assertTrue(result + " should match", result.equals(SALTEDPW)); }