@Test public void testEmailValidation() { assertTrue(ValidationUtil.isWellFormedEmail("*****@*****.**")); assertTrue(ValidationUtil.isWellFormedEmail("*****@*****.**")); assertTrue(ValidationUtil.isWellFormedEmail("[email protected] ")); assertTrue(ValidationUtil.isWellFormedEmail(" [email protected] ")); assertFalse(ValidationUtil.isWellFormedEmail("xx.jb_0m@atira")); assertFalse(ValidationUtil.isWellFormedEmail(null)); assertFalse(ValidationUtil.isWellFormedEmail("")); assertFalse(ValidationUtil.isWellFormedEmail("xx")); assertFalse(ValidationUtil.isWellFormedEmail("[email protected]")); assertFalse(ValidationUtil.isWellFormedEmail("xx.jb_0m@atira.")); assertTrue(StringUtils.containsOnly("abc", "abcdefghijklmnopqrstuvwxyz0123456789")); }
@Test public void testValidPassword() { assertFalse(ValidationUtil.isValidPassword("")); assertFalse(ValidationUtil.isValidPassword(null)); assertFalse(ValidationUtil.isValidPassword(" ")); assertFalse(ValidationUtil.isValidPassword(" ")); assertFalse(ValidationUtil.isValidPassword(" abcABC123-+& ")); assertFalse(ValidationUtil.isValidPassword(" abcABC123-+&")); assertFalse(ValidationUtil.isValidPassword("abcABC123-+& ")); assertFalse(ValidationUtil.isValidPassword("abBC12+")); assertTrue(ValidationUtil.isValidPassword("abcABC123-+&")); }
@Test public void testValidUsername() { assertFalse(ValidationUtil.isValidUsername("")); assertFalse(ValidationUtil.isValidUsername(null)); assertFalse(ValidationUtil.isValidUsername(" ")); assertFalse(ValidationUtil.isValidUsername(" abc")); assertFalse(ValidationUtil.isValidUsername("abc123+")); assertFalse(ValidationUtil.isValidUsername("*****@*****.**")); assertTrue(ValidationUtil.isValidUsername("a")); assertTrue(ValidationUtil.isValidUsername("abc")); assertTrue(ValidationUtil.isValidUsername("abc123")); }