forked from AY2324S1-CS2103-F13-2/tp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
17 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,27 +52,26 @@ public void isValidEmail() { | |
assertFalse(Email.isValidEmail("[email protected]")); // domain name starts with a hyphen | ||
assertFalse(Email.isValidEmail("[email protected]")); // domain name ends with a hyphen | ||
assertFalse(Email.isValidEmail("[email protected]")); // top level domain has less than two chars | ||
assertFalse(Email.isValidEmail("test@localhost")); // alphabets only | ||
assertFalse(Email.isValidEmail("123@145")); // numeric domain name | ||
assertFalse(Email.isValidEmail("[email protected]")); // mixture of alphanumeric and special characters | ||
assertFalse(Email.isValidEmail("[email protected]")); // domain name has symbols | ||
|
||
// valid email | ||
assertTrue(Email.isValidEmail("[email protected]")); // underscore in local part | ||
assertTrue(Email.isValidEmail("[email protected]")); // period in local part | ||
assertTrue(Email.isValidEmail("[email protected]")); // '+' symbol in local part | ||
assertTrue(Email.isValidEmail("[email protected]")); // hyphen in local part | ||
assertTrue(Email.isValidEmail("a@bc")); // minimal | ||
assertTrue(Email.isValidEmail("test@localhost")); // alphabets only | ||
assertTrue(Email.isValidEmail("123@145")); // numeric local part and domain name | ||
assertTrue(Email.isValidEmail("[email protected]")); // mixture of alphanumeric and special characters | ||
assertTrue(Email.isValidEmail("[email protected]")); // long domain name | ||
assertTrue(Email.isValidEmail("[email protected]")); // long local part | ||
assertTrue(Email.isValidEmail("[email protected]")); // more than one period in domain | ||
} | ||
|
||
@Test | ||
public void equals() { | ||
Email email = new Email("valid@email"); | ||
Email email = new Email("valid@email.com"); | ||
|
||
// same values -> returns true | ||
assertTrue(email.equals(new Email("valid@email"))); | ||
assertTrue(email.equals(new Email("valid@email.com"))); | ||
|
||
// same object -> returns true | ||
assertTrue(email.equals(email)); | ||
|
@@ -84,7 +83,7 @@ public void equals() { | |
assertFalse(email.equals(5.0f)); | ||
|
||
// different values -> returns false | ||
assertFalse(email.equals(new Email("other.valid@email"))); | ||
assertFalse(email.equals(new Email("other.valid@email.com"))); | ||
} | ||
|
||
@Test | ||
|