package seedu.address.model.task;

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

import org.junit.Test;

import seedu.address.model.task.Priority;

public class PriorityTest {

    @Test
    public void isValidPriority() {
        // invalid name
        assertFalse(Priority.isValidPriority("")); // empty string
        assertFalse(Priority.isValidPriority(" ")); // spaces only
        assertFalse(Priority.isValidPriority("*")); // only non-alphanumeric characters
        assertFalse(Priority.isValidPriority("vital!")); // contains illegal expression

        // valid name
        assertTrue(Priority.isValidPriority("1")); // 1
        assertTrue(Priority.isValidPriority("2")); // 2
        assertTrue(Priority.isValidPriority("3")); // 3
        assertTrue(Priority.isValidPriority("important")); // approved expression with lower case
        assertTrue(Priority.isValidPriority("trivial"));
        assertTrue(Priority.isValidPriority("normal"));
        assertTrue(Priority.isValidPriority("NORMAL")); // approved expression with upper case
        assertTrue(Priority.isValidPriority("TriVAl")); // approved expression with mix case
    }
}

@@ -28,16 +28,61 @@
 .task;%0A%0A
+import static org.junit.Assert.assertEquals;%0A
 import s
@@ -182,86 +182,920 @@
 nit.
-Test;%0A%0Aimport seedu.address.model.task.Priority;%0A%0Apublic class PriorityTest %7B%0A
+Rule;%0Aimport org.junit.Test;%0Aimport org.junit.rules.ExpectedException;%0A%0Aimport seedu.address.commons.exceptions.IllegalValueException;%0Aimport seedu.address.model.task.Priority;%0A%0Apublic class PriorityTest %7B%0A    %0A    @Rule%0A    public ExpectedException thrown = ExpectedException.none();%0A%0A    @Test%0A    public void convert() %7B%0A        // exact expressions%0A        assertEquals(Priority.convert(Priority.PRIORITY_IMPORTANT), Priority.PRIORITY_3);%0A        assertEquals(Priority.convert(Priority.PRIORITY_NORMAL), Priority.PRIORITY_2);%0A        assertEquals(Priority.convert(Priority.PRIORITY_TRIVIAL), Priority.PRIORITY_1);%0A        assertEquals(Priority.convert(%22%22), Priority.DEFAULT_PRIORITY);%0A        %0A        // same expressions with different case or mix case%0A        assertEquals(Priority.convert(%22TRIVIAL%22), Priority.PRIORITY_1);%0A        assertEquals(Priority.convert(%22tRiViAl%22), Priority.PRIORITY_1);%0A    %7D%0A    
 %0A   
@@ -1471,16 +1471,100 @@
 ression%0A
+        assertFalse(Priority.isValidPriority(%22trivial%22)); // not 1, 2, or 3%0A        
 %0A       
@@ -1754,137 +1754,218 @@
     
+%7D%0A
     
-assertTrue(Priority.isValidPriority(%22important%22)); // approved expression with lower case%0A        assertTrue(Priority.isValid
+%0A    @Test%0A    public void invalidNameTest() throws IllegalValueException %7B%0A        //invalid name by illegal expression%0A        thrown.expect(IllegalValueException.class);%0A        Priority tester1 = new 
 Prio
@@ -1974,142 +1974,364 @@
 ty(%22
-tri
 vi
+t
 al
+!
 %22
-)
 );%0A    
+%7D%0A
     
-assertTrue(Priority.isValidPriority(%22normal%22));%0A        assertTrue(Priority.isValidPriority(%22NORMAL%22)); // approve
+%0A    @Test%0A    public void validNameTest() throws IllegalValueException %7B%0A        //valid name%0A        Priority tester2a = new Priority(%22%22); // empty string%0A        Priority tester2b = new Priority(%22 %22); // space%0A        Priority tester2c = new Priority(%221%22); // 1, 2, or 3%0A        Priority tester2d = new Priority(%22important%22); // vali
 d ex
@@ -2348,13 +2348,12 @@
 ith 
-upper
+same
  cas
@@ -2366,35 +2366,32 @@
     
-assertTrue(Priority.isValid
+Priority tester2e = new 
 Prio
@@ -2400,29 +2400,25 @@
 ty(%22
-TriVA
+NorMa
 l%22)
-)
 ; // 
-approve
+vali
 d ex
@@ -2431,24 +2431,279 @@
 on with 
-mix case
+different case%0A        %0A        assertEquals(tester2a.getValue(), %222%22);%0A        assertEquals(tester2b.getValue(), %222%22);%0A        assertEquals(tester2c.getValue(), %221%22);%0A        assertEquals(tester2d.getValue(), %223%22);%0A        assertEquals(tester2e.getValue(), %222%22);
 %0A    %7D%0A%7D

Add test for Priority