-
Notifications
You must be signed in to change notification settings - Fork 482
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
1036713
commit e349452
Showing
7 changed files
with
99 additions
and
6 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
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,4 @@ | ||
package Jelly.task; | ||
|
||
public class ToDoTest { | ||
} |
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,44 @@ | ||
package Jelly.main; | ||
|
||
import Jelly.exceptions.JellyException; | ||
import Jelly.task.Deadline; | ||
import Jelly.task.Task; | ||
import Jelly.task.Todo; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
|
||
public class StorageTest { | ||
@Test | ||
public void startUpTest() throws IOException, JellyException { | ||
File tempTasks = File.createTempFile("tempTasks",".txt"); | ||
|
||
String filePath = tempTasks.getAbsolutePath(); | ||
Storage storage = new Storage(filePath); | ||
|
||
ArrayList<Task> taskList = new ArrayList<>(); | ||
taskList.add(new Todo("Do that")); | ||
taskList.get(0).markAsDone(); | ||
taskList.add(new Deadline("Do this thing", "18/12/2020 1900")); | ||
|
||
TaskList savedList = new TaskList(taskList); | ||
storage.saveAndExit(savedList); | ||
|
||
ArrayList<Task> loadedList = storage.startUp(); | ||
tempTasks.deleteOnExit(); | ||
|
||
for (int i = 0; i < taskList.size(); i++) { | ||
assertEquals(taskList.get(i).getDescription(), | ||
loadedList.get(i).getDescription()); | ||
assertEquals(taskList.get(i).getIsDone(), | ||
loadedList.get(i).getIsDone()); | ||
} | ||
} | ||
|
||
} |
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,29 @@ | ||
package Jelly.main; | ||
|
||
|
||
import Jelly.task.Task; | ||
import Jelly.task.Todo; | ||
import org.junit.jupiter.api.Test; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
|
||
public class TaskListTest { | ||
@Test | ||
public void markTest() { | ||
TaskList taskList = new TaskList(); | ||
Task todo = new Todo("Do this"); | ||
taskList.add(todo); | ||
taskList.markAsDone(0); | ||
assertTrue(todo.getIsDone()); | ||
} | ||
@Test | ||
public void unmarkTest() { | ||
TaskList taskList = new TaskList(); | ||
Task todo = new Todo("Do this"); | ||
todo.markAsDone(); | ||
taskList.add(todo); | ||
taskList.markAsUndone(0); | ||
assertFalse(todo.getIsDone()); | ||
} | ||
} |
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,17 @@ | ||
package Jelly.task; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class ToDoTest { | ||
@Test | ||
public void dummyTest(){ | ||
assertEquals(2, 2); | ||
} | ||
|
||
@Test | ||
public void anotherDummyTest(){ | ||
assertEquals(4, 4); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,3 +1,2 @@ | ||
E | 1 | do this | 12/02/1010 1900 to 13/10/2020 1900 | ||
D | 0 | do this thing | 12/02/1900 1900 | ||
T | 0 | that thing | ||
T | 1 | Do that | ||
D | 0 | Do this thing | 18/12/2020 1900 |