package seedu.task.model.person;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.junit.Test;

import seedu.task.model.task.EndTime;

public class EmailTest {

    @Test
    public void isValidEmail() {
        // blank email
        assertFalse(EndTime.isValidTime("")); // empty string
        assertFalse(EndTime.isValidTime(" ")); // spaces only

        // missing parts
        assertFalse(EndTime.isValidTime("@webmail.com")); // missing local part
        assertFalse(EndTime.isValidTime("peterjackwebmail.com")); // missing '@' symbol
        assertFalse(EndTime.isValidTime("peterjack@")); // missing domain name

        // invalid parts
        assertFalse(EndTime.isValidTime("-@webmail.com")); // invalid local part
        assertFalse(EndTime.isValidTime("peterjack@-")); // invalid domain name
        assertFalse(EndTime.isValidTime("peter jack@webmail.com")); // spaces in local part
        assertFalse(EndTime.isValidTime("peterjack@web mail.com")); // spaces in domain name
        assertFalse(EndTime.isValidTime("peterjack@@webmail.com")); // double '@' symbol
        assertFalse(EndTime.isValidTime("peter@jack@webmail.com")); // '@' symbol in local part
        assertFalse(EndTime.isValidTime("peterjack@webmail@com")); // '@' symbol in domain name

        // valid email
        assertTrue(EndTime.isValidTime("PeterJack_1190@WEB.Mail.com"));
        assertTrue(EndTime.isValidTime("a@b"));  // minimal
        assertTrue(EndTime.isValidTime("test@localhost"));   // alphabets only
        assertTrue(EndTime.isValidTime("123@145"));  // numeric local part and domain name
        assertTrue(EndTime.isValidTime("a1@sg50.org"));  // mixture of alphanumeric and dot characters
        assertTrue(EndTime.isValidTime("_user_@_do_main_.com_"));    // underscores
        assertTrue(EndTime.isValidTime("peter_jack@a_very_long_domain_AVLD.com"));   // long domain name
        assertTrue(EndTime.isValidTime("if.you.dream.it_you.can.do.it@youth_email.com"));    // long local part
    }
}

@@ -208,22 +208,16 @@
  %7B%0A%0A
-    
+%09
 @Test%0A
-    
+%09
 publ
@@ -241,24 +241,18 @@
 ail() %7B%0A
-        
+%09%09
 // blank
@@ -254,24 +254,28 @@
 blank email%0A
+%09%09//
         asse
@@ -324,16 +324,20 @@
  string%0A
+%09%09//
         
@@ -391,24 +391,18 @@
 s only%0A%0A
-        
+%09%09
 // missi
@@ -406,32 +406,26 @@
 ssing parts%0A
-        
+%09%09
 assertFalse(
@@ -480,32 +480,26 @@
  local part%0A
-        
+%09%09
 assertFalse(
@@ -562,32 +562,26 @@
  '@' symbol%0A
-        
+%09%09
 assertFalse(
@@ -640,24 +640,18 @@
 n name%0A%0A
-        
+%09%09
 // inval
@@ -659,24 +659,18 @@
 d parts%0A
-        
+%09%09
 assertFa
@@ -730,32 +730,26 @@
  local part%0A
-        
+%09%09
 assertFalse(
@@ -804,32 +804,26 @@
 domain name%0A
-        
+%09%09
 assertFalse(
@@ -890,32 +890,26 @@
  local part%0A
-        
+%09%09
 assertFalse(
@@ -977,32 +977,26 @@
 domain name%0A
-        
+%09%09
 assertFalse(
@@ -1064,24 +1064,18 @@
  symbol%0A
-        
+%09%09
 assertFa
@@ -1154,24 +1154,18 @@
 al part%0A
-        
+%09%09
 assertFa
@@ -1245,24 +1245,18 @@
 n name%0A%0A
-        
+%09%09
 // valid
@@ -1262,24 +1262,18 @@
 d email%0A
-        
+%09%09
 assertTr
@@ -1300,48 +1300,30 @@
 me(%22
-PeterJack_1190@WEB.Mail.com%22));%0A        
+270717 2359%22));%0A%09%09//%09%09
 asse
@@ -1370,24 +1370,22 @@
 minimal%0A
-        
+%09%09//%09%09
 assertTr
@@ -1447,24 +1447,22 @@
 ts only%0A
-        
+%09%09//%09%09
 assertTr
@@ -1532,32 +1532,30 @@
 domain name%0A
-        
+%09%09//%09%09
 assertTrue(E
@@ -1637,24 +1637,22 @@
 racters%0A
-        
+%09%09//%09%09
 assertTr
@@ -1719,24 +1719,22 @@
 rscores%0A
-        
+%09%09//%09%09
 assertTr
@@ -1822,24 +1822,22 @@
 in name%0A
-        
+%09%09//%09%09
 assertTr
@@ -1932,16 +1932,13 @@
 al part%0A
-    
+%09
 %7D%0A%7D%0A

Modify asserts that check for valid time