### Question:
StringUtil { public boolean isValidPassword(String password) { Pattern p = Pattern.compile("^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=\\S+$).{8,}$"); Matcher m = p.matcher(password); if (m.find()) return true; return false; }  boolean isValidPassword(String password);  }### Answer:
@Test public void it_should_validate_passwords() { String validPassword = "As1asd1sdas21"; String invalidPassword = "asd123"; assertTrue(stringUtil.isValidPassword(validPassword)); assertFalse(stringUtil.isValidPassword(invalidPassword)); }