forked from nus-cs2103-AY2021S1/ip
-
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
1 parent
2852fa0
commit a1cc203
Showing
7 changed files
with
205 additions
and
1 deletion.
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
Empty file.
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package Tasks; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import java.time.LocalDateTime; | ||
import java.time.format.DateTimeFormatter; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class DeadlineTest { | ||
final task t2 = new Deadline("Test 2","[D]"); | ||
final task t2Done = new Deadline("Test 2","[D]"); | ||
|
||
@Test | ||
void taskName() { | ||
assertEquals("Test 2",t2.taskName()); | ||
} | ||
|
||
@Test | ||
void taskCompleted() { | ||
t2Done.done(); | ||
assertEquals(false,t2.taskCompleted()); | ||
assertEquals(true,t2Done.taskCompleted()); | ||
} | ||
|
||
@Test | ||
void taskType() { | ||
assertEquals("[D]",t2.taskType()); | ||
} | ||
|
||
@Test | ||
void taskDate() { | ||
DateTimeFormatter format = DateTimeFormatter.ofPattern("d-MM-uuuu HHmm"); | ||
LocalDateTime dt1 = LocalDateTime.parse("5-12-2020 1200",format); | ||
t2.setDate(dt1); | ||
assertEquals(dt1,t2.taskDate()); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package Tasks; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import java.time.LocalDateTime; | ||
import java.time.format.DateTimeFormatter; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class EventTest { | ||
final task t3 = new Event("Test 3","[E]"); | ||
final task t3Done = new Event("Test 3","[E]"); | ||
|
||
@Test | ||
void taskName() { | ||
assertEquals("Test 3",t3.taskName()); | ||
} | ||
|
||
@Test | ||
void taskCompleted() { | ||
t3Done.done(); | ||
assertEquals(false,t3.taskCompleted()); | ||
assertEquals(true,t3Done.taskCompleted()); | ||
} | ||
|
||
@Test | ||
void taskType() { | ||
assertEquals("[E]",t3.taskType()); | ||
} | ||
|
||
@Test | ||
void taskDate() { | ||
DateTimeFormatter format = DateTimeFormatter.ofPattern("d-MM-uuuu HHmm"); | ||
LocalDateTime dt2 = LocalDateTime.parse("6-12-2020 1200",format); | ||
t3.setDate(dt2); | ||
assertEquals(dt2,t3.taskDate()); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package Tasks; | ||
|
||
import Errors.ErrorExceptions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.ArrayList; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class TaskManagerTest { | ||
String date = "12-12-1212 1200"; | ||
String dir = "./TestingSave.txt"; | ||
final task t1 = new Todo("Test 1","[T]"); | ||
final task t2 = new Deadline("Test 2","[D]"); | ||
final task t3 = new Event("Test 3","[E]"); | ||
|
||
@Test | ||
void getTask() throws ErrorExceptions { | ||
// TaskManager.newTask("Test 1","[T]",null,dir); | ||
// TaskManager.newTask("Test 2","[D]",date,dir); | ||
// TaskManager.newTask("Test 3","[E]",date,dir); | ||
// assertEquals(t1,TaskManager.getTask(0)); | ||
// assertEquals(t1,TaskManager.getTask(1)); | ||
// assertEquals(t1,TaskManager.getTask(2)); | ||
} | ||
|
||
@Test | ||
void storeIndex() { | ||
} | ||
|
||
@Test | ||
void read() { | ||
} | ||
|
||
@Test | ||
void getStore() { | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package Tasks; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class TodoTest { | ||
final Todo t1 = new Todo("Test 1","[T]"); | ||
final task t1Done = new Todo("Test 1","[T]"); | ||
|
||
@Test | ||
void taskName() { | ||
assertEquals("Test 1",t1.taskName()); | ||
} | ||
|
||
@Test | ||
void taskCompleted() { | ||
t1Done.done(); | ||
assertEquals(false,t1.taskCompleted()); | ||
assertEquals(true,t1Done.taskCompleted()); | ||
} | ||
|
||
@Test | ||
void taskType() { | ||
assertEquals("[T]",t1.taskType()); | ||
} | ||
|
||
@Test | ||
void taskDate() { | ||
assertEquals(null,t1.taskDate()); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package Tasks; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.time.LocalDateTime; | ||
import java.time.format.DateTimeFormatter; | ||
import java.util.Date; | ||
|
||
|
||
class taskTest { | ||
final task t1 = new Todo("Test 1","[T]"); | ||
final task t2 = new Deadline("Test 2","[D]"); | ||
final task t3 = new Event("Test 3","[E]"); | ||
|
||
final task t1Done = new Todo("Test 1","[T]"); | ||
final task t2Done = new Deadline("Test 2","[D]"); | ||
final task t3Done = new Event("Test 3","[E]"); | ||
|
||
@Test | ||
void taskName() { | ||
assertEquals("Test 1",t1.taskName()); | ||
assertEquals("Test 2",t2.taskName()); | ||
assertEquals("Test 3",t3.taskName()); | ||
} | ||
|
||
@Test | ||
void taskCompleted() { | ||
t1Done.done(); | ||
t2Done.done(); | ||
t3Done.done(); | ||
assertEquals(false,t1.taskCompleted()); | ||
assertEquals(false,t2.taskCompleted()); | ||
assertEquals(false,t3.taskCompleted()); | ||
assertEquals(true,t1Done.taskCompleted()); | ||
assertEquals(true,t2Done.taskCompleted()); | ||
assertEquals(true,t3Done.taskCompleted()); | ||
} | ||
|
||
@Test | ||
void taskType() { | ||
assertEquals("[T]",t1.taskType()); | ||
assertEquals("[D]",t2.taskType()); | ||
assertEquals("[E]",t3.taskType()); | ||
} | ||
|
||
@Test | ||
void taskDate() { | ||
DateTimeFormatter format = DateTimeFormatter.ofPattern("d-MM-uuuu HHmm"); | ||
LocalDateTime dt1 = LocalDateTime.parse("5-12-2020 1200",format); | ||
LocalDateTime dt2 = LocalDateTime.parse("6-12-2020 1200",format); | ||
t2.setDate(dt1); | ||
t3.setDate(dt2); | ||
|
||
assertEquals(null,t1.taskDate()); | ||
assertEquals(dt1,t2.taskDate()); | ||
assertEquals(dt2,t3.taskDate()); | ||
} | ||
} |