Skip to content

Commit

Permalink
Merge pull request #106 from raydenlim/branch-AddTestCases
Browse files Browse the repository at this point in the history
Add testcases for email
  • Loading branch information
raydenlim authored Oct 28, 2023
2 parents 1ba0f46 + 1ede526 commit 92e383b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/test/java/seedu/address/model/person/EmailTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,22 @@ public void isValidEmail() {
assertTrue(Email.isValidEmail("e1234567@u.nus.edu")); // more than one period in domain
}

@Test
public void isValidEmail_edgeCase_pass() {
assertTrue(Email.isValidEmail("A.B@cdomain.edu.fr")); // ends with .fr
assertTrue(Email.isValidEmail("iamsmart@bigbrain.io"));
assertTrue(Email.isValidEmail("someemail@stu.comp.nus.edu.sg")); // long domain labels
assertTrue(Email.isValidEmail("peterjack@example.a.b.c.e.d.f.g.com")); // long invalid domain labels
}

@Test
public void isValidEmail_edgeCase_fail() {
assertFalse(Email.isValidEmail("peterjack@example.com@")); // ends with @
assertFalse(Email.isValidEmail("www.thisismyemail.com")); // http format
assertFalse(Email.isValidEmail("user@[192.168.0.1].com")); // invalid char used
assertFalse(Email.isValidEmail("user@example..com")); // multiple .
}

@Test
public void equals() {
Email email = new Email("valid@email");
Expand Down

0 comments on commit 92e383b

Please sign in to comment.