diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java index b711fda754..92b227f26b 100644 --- a/src/main/java/Duke.java +++ b/src/main/java/Duke.java @@ -1,8 +1,9 @@ -import duke.command.Command; -import duke.command.Storage; -import duke.command.Ui; -import duke.dukeexception.DukeException; -import duke.task.TaskList; +import duchess.logic.commands.Command; +import duchess.logic.parser.Parser; +import duchess.storage.Storage; +import duchess.ui.Ui; +import duchess.logic.commands.exceptions.DukeException; +import duchess.storage.task.TaskList; public class Duke { diff --git a/src/main/java/duke/command/AddDeadlineCommand.java b/src/main/java/duchess/logic/commands/AddDeadlineCommand.java similarity index 67% rename from src/main/java/duke/command/AddDeadlineCommand.java rename to src/main/java/duchess/logic/commands/AddDeadlineCommand.java index ada3c39017..86de478289 100644 --- a/src/main/java/duke/command/AddDeadlineCommand.java +++ b/src/main/java/duchess/logic/commands/AddDeadlineCommand.java @@ -1,9 +1,12 @@ -package duke.command; +package duchess.logic.commands; + +import duchess.storage.Storage; +import duchess.storage.task.TaskList; +import duchess.storage.task.Task; +import duchess.storage.task.Deadline; +import duchess.logic.commands.exceptions.DukeException; +import duchess.ui.Ui; -import duke.task.TaskList; -import duke.task.Task; -import duke.task.Deadline; -import duke.dukeexception.DukeException; import java.util.List; public class AddDeadlineCommand extends Command { diff --git a/src/main/java/duke/command/AddEventCommand.java b/src/main/java/duchess/logic/commands/AddEventCommand.java similarity index 73% rename from src/main/java/duke/command/AddEventCommand.java rename to src/main/java/duchess/logic/commands/AddEventCommand.java index b32cdc2a61..2510885337 100644 --- a/src/main/java/duke/command/AddEventCommand.java +++ b/src/main/java/duchess/logic/commands/AddEventCommand.java @@ -1,8 +1,10 @@ -package duke.command; +package duchess.logic.commands; -import duke.dukeexception.DukeException; -import duke.task.Event; -import duke.task.TaskList; +import duchess.storage.Storage; +import duchess.logic.commands.exceptions.DukeException; +import duchess.storage.task.Event; +import duchess.storage.task.TaskList; +import duchess.ui.Ui; import java.util.List; diff --git a/src/main/java/duke/command/AddTodoCommand.java b/src/main/java/duchess/logic/commands/AddTodoCommand.java similarity index 65% rename from src/main/java/duke/command/AddTodoCommand.java rename to src/main/java/duchess/logic/commands/AddTodoCommand.java index d05f568d8f..6be712053b 100644 --- a/src/main/java/duke/command/AddTodoCommand.java +++ b/src/main/java/duchess/logic/commands/AddTodoCommand.java @@ -1,9 +1,12 @@ -package duke.command; +package duchess.logic.commands; + +import duchess.storage.Storage; +import duchess.storage.task.TaskList; +import duchess.storage.task.Todo; +import duchess.storage.task.Task; +import duchess.logic.commands.exceptions.DukeException; +import duchess.ui.Ui; -import duke.task.TaskList; -import duke.task.Todo; -import duke.task.Task; -import duke.dukeexception.DukeException; import java.util.List; public class AddTodoCommand extends Command { diff --git a/src/main/java/duke/command/ByeCommand.java b/src/main/java/duchess/logic/commands/ByeCommand.java similarity index 71% rename from src/main/java/duke/command/ByeCommand.java rename to src/main/java/duchess/logic/commands/ByeCommand.java index 4ab3e99386..5fbb588645 100644 --- a/src/main/java/duke/command/ByeCommand.java +++ b/src/main/java/duchess/logic/commands/ByeCommand.java @@ -1,7 +1,9 @@ -package duke.command; +package duchess.logic.commands; -import duke.task.TaskList; -import duke.dukeexception.DukeException; +import duchess.storage.Storage; +import duchess.storage.task.TaskList; +import duchess.logic.commands.exceptions.DukeException; +import duchess.ui.Ui; public class ByeCommand extends Command { /** diff --git a/src/main/java/duke/command/Command.java b/src/main/java/duchess/logic/commands/Command.java similarity index 56% rename from src/main/java/duke/command/Command.java rename to src/main/java/duchess/logic/commands/Command.java index b67c79b2d0..6b318e9d91 100644 --- a/src/main/java/duke/command/Command.java +++ b/src/main/java/duchess/logic/commands/Command.java @@ -1,7 +1,9 @@ -package duke.command; +package duchess.logic.commands; -import duke.dukeexception.DukeException; -import duke.task.TaskList; +import duchess.storage.Storage; +import duchess.logic.commands.exceptions.DukeException; +import duchess.storage.task.TaskList; +import duchess.ui.Ui; public abstract class Command { protected boolean isExit; diff --git a/src/main/java/duke/command/DeleteCommand.java b/src/main/java/duchess/logic/commands/DeleteCommand.java similarity index 83% rename from src/main/java/duke/command/DeleteCommand.java rename to src/main/java/duchess/logic/commands/DeleteCommand.java index 4e6a23bb86..35973dab5f 100644 --- a/src/main/java/duke/command/DeleteCommand.java +++ b/src/main/java/duchess/logic/commands/DeleteCommand.java @@ -1,8 +1,10 @@ -package duke.command; +package duchess.logic.commands; -import duke.task.TaskList; -import duke.task.Task; -import duke.dukeexception.DukeException; +import duchess.storage.Storage; +import duchess.storage.task.TaskList; +import duchess.storage.task.Task; +import duchess.logic.commands.exceptions.DukeException; +import duchess.ui.Ui; import java.util.List; diff --git a/src/main/java/duke/command/DoneCommand.java b/src/main/java/duchess/logic/commands/DoneCommand.java similarity index 78% rename from src/main/java/duke/command/DoneCommand.java rename to src/main/java/duchess/logic/commands/DoneCommand.java index dba44bfff8..a4701fa287 100644 --- a/src/main/java/duke/command/DoneCommand.java +++ b/src/main/java/duchess/logic/commands/DoneCommand.java @@ -1,8 +1,11 @@ -package duke.command; +package duchess.logic.commands; + +import duchess.storage.Storage; +import duchess.storage.task.TaskList; +import duchess.logic.commands.exceptions.DukeException; +import duchess.storage.task.Task; +import duchess.ui.Ui; -import duke.task.TaskList; -import duke.dukeexception.DukeException; -import duke.task.Task; import java.util.List; public class DoneCommand extends Command { diff --git a/src/main/java/duke/command/FindCommand.java b/src/main/java/duchess/logic/commands/FindCommand.java similarity index 82% rename from src/main/java/duke/command/FindCommand.java rename to src/main/java/duchess/logic/commands/FindCommand.java index 16a5c28436..6e8bb803c2 100644 --- a/src/main/java/duke/command/FindCommand.java +++ b/src/main/java/duchess/logic/commands/FindCommand.java @@ -1,8 +1,11 @@ -package duke.command; +package duchess.logic.commands; + +import duchess.storage.Storage; +import duchess.storage.task.Task; +import duchess.storage.task.TaskList; +import duchess.logic.commands.exceptions.DukeException; +import duchess.ui.Ui; -import duke.task.Task; -import duke.task.TaskList; -import duke.dukeexception.DukeException; import java.util.List; import java.util.stream.Collectors; diff --git a/src/main/java/duke/command/ListCommand.java b/src/main/java/duchess/logic/commands/ListCommand.java similarity index 53% rename from src/main/java/duke/command/ListCommand.java rename to src/main/java/duchess/logic/commands/ListCommand.java index f430fe3cfb..bf0aa639ea 100644 --- a/src/main/java/duke/command/ListCommand.java +++ b/src/main/java/duchess/logic/commands/ListCommand.java @@ -1,7 +1,9 @@ -package duke.command; +package duchess.logic.commands; -import duke.dukeexception.DukeException; -import duke.task.TaskList; +import duchess.storage.Storage; +import duchess.logic.commands.exceptions.DukeException; +import duchess.storage.task.TaskList; +import duchess.ui.Ui; public class ListCommand extends Command { @Override diff --git a/src/main/java/duke/command/ReminderCommand.java b/src/main/java/duchess/logic/commands/ReminderCommand.java similarity index 84% rename from src/main/java/duke/command/ReminderCommand.java rename to src/main/java/duchess/logic/commands/ReminderCommand.java index 1435320750..e91e817a3a 100644 --- a/src/main/java/duke/command/ReminderCommand.java +++ b/src/main/java/duchess/logic/commands/ReminderCommand.java @@ -1,56 +1,58 @@ -package duke.command; - -import duke.dukeexception.DukeException; -import duke.task.Deadline; -import duke.task.Task; -import duke.task.TaskList; - -import java.util.ArrayList; -import java.util.List; - -/** - * Searches Tasklist and filters out deadline objects. - */ -public class ReminderCommand extends Command { - - /** - * Displays Deadline objects to user. - * - * @param taskList List containing tasks - * @param ui Userinterface object - * @param storage Storage object - * @throws DukeException Exception thrown when storage not found - */ - @Override - public void execute(TaskList taskList, Ui ui, Storage storage) throws DukeException { - List reminderList = addDeadlines(taskList); - display(reminderList, ui); - } - - /** - * Returns a List of Task objects. - * Adds objects of type Deadline to reminderList. - * - * @param taskList of user inputs - */ - private List addDeadlines(TaskList taskList) { - ArrayList reminderList = new ArrayList<>(); - for (Task task : taskList.getTasks()) { - if (task instanceof Deadline) { - reminderList.add(task); - } - } - return reminderList; - } - - /** - * Displays deadlines to user. - */ - private void display(List reminderList, Ui ui) { - if (reminderList.size() == 0) { - ui.showNoDeadlines(); - } else { - ui.showDeadlines(reminderList); - } - } +package duchess.logic.commands; + +import duchess.storage.Storage; +import duchess.logic.commands.exceptions.DukeException; +import duchess.storage.task.Deadline; +import duchess.storage.task.Task; +import duchess.storage.task.TaskList; +import duchess.ui.Ui; + +import java.util.ArrayList; +import java.util.List; + +/** + * Searches Tasklist and filters out deadline objects. + */ +public class ReminderCommand extends Command { + + /** + * Displays Deadline objects to user. + * + * @param taskList List containing tasks + * @param ui Userinterface object + * @param storage Storage object + * @throws DukeException Exception thrown when storage not found + */ + @Override + public void execute(TaskList taskList, Ui ui, Storage storage) throws DukeException { + List reminderList = addDeadlines(taskList); + display(reminderList, ui); + } + + /** + * Returns a List of Task objects. + * Adds objects of type Deadline to reminderList. + * + * @param taskList of user inputs + */ + private List addDeadlines(TaskList taskList) { + ArrayList reminderList = new ArrayList<>(); + for (Task task : taskList.getTasks()) { + if (task instanceof Deadline) { + reminderList.add(task); + } + } + return reminderList; + } + + /** + * Displays deadlines to user. + */ + private void display(List reminderList, Ui ui) { + if (reminderList.size() == 0) { + ui.showNoDeadlines(); + } else { + ui.showDeadlines(reminderList); + } + } } \ No newline at end of file diff --git a/src/main/java/duke/command/SnoozeCommand.java b/src/main/java/duchess/logic/commands/SnoozeCommand.java similarity index 78% rename from src/main/java/duke/command/SnoozeCommand.java rename to src/main/java/duchess/logic/commands/SnoozeCommand.java index 6a39d45a92..6f2a1876f2 100644 --- a/src/main/java/duke/command/SnoozeCommand.java +++ b/src/main/java/duchess/logic/commands/SnoozeCommand.java @@ -1,9 +1,11 @@ -package duke.command; +package duchess.logic.commands; -import duke.dukeexception.DukeException; -import duke.task.Snoozeable; -import duke.task.Task; -import duke.task.TaskList; +import duchess.storage.Storage; +import duchess.logic.commands.exceptions.DukeException; +import duchess.storage.task.Snoozeable; +import duchess.storage.task.Task; +import duchess.storage.task.TaskList; +import duchess.ui.Ui; import java.util.List; diff --git a/src/main/java/duke/command/ViewScheduleCommand.java b/src/main/java/duchess/logic/commands/ViewScheduleCommand.java similarity index 90% rename from src/main/java/duke/command/ViewScheduleCommand.java rename to src/main/java/duchess/logic/commands/ViewScheduleCommand.java index cf19cd3ea7..918eaffffd 100644 --- a/src/main/java/duke/command/ViewScheduleCommand.java +++ b/src/main/java/duchess/logic/commands/ViewScheduleCommand.java @@ -1,8 +1,11 @@ -package duke.command; +package duchess.logic.commands; -import duke.dukeexception.DukeException; -import duke.task.Task; -import duke.task.TaskList; +import duchess.model.Schedule; +import duchess.storage.Storage; +import duchess.logic.commands.exceptions.DukeException; +import duchess.storage.task.Task; +import duchess.storage.task.TaskList; +import duchess.ui.Ui; import java.text.ParseException; import java.text.SimpleDateFormat; diff --git a/src/main/java/duke/dukeexception/DukeException.java b/src/main/java/duchess/logic/commands/exceptions/DukeException.java similarity index 74% rename from src/main/java/duke/dukeexception/DukeException.java rename to src/main/java/duchess/logic/commands/exceptions/DukeException.java index 601c020dd2..ec21425e6a 100644 --- a/src/main/java/duke/dukeexception/DukeException.java +++ b/src/main/java/duchess/logic/commands/exceptions/DukeException.java @@ -1,4 +1,4 @@ -package duke.dukeexception; +package duchess.logic.commands.exceptions; public class DukeException extends Exception { public DukeException(String message) { diff --git a/src/main/java/Parser.java b/src/main/java/duchess/logic/parser/Parser.java similarity index 69% rename from src/main/java/Parser.java rename to src/main/java/duchess/logic/parser/Parser.java index 0b781096e2..fc18e8d0fa 100644 --- a/src/main/java/Parser.java +++ b/src/main/java/duchess/logic/parser/Parser.java @@ -1,21 +1,23 @@ -import duke.command.AddDeadlineCommand; -import duke.command.AddEventCommand; -import duke.command.AddTodoCommand; -import duke.command.ByeCommand; -import duke.command.Command; -import duke.command.DeleteCommand; -import duke.command.DoneCommand; -import duke.command.FindCommand; -import duke.command.ListCommand; -import duke.command.ReminderCommand; -import duke.command.SnoozeCommand; -import duke.command.ViewScheduleCommand; -import duke.dukeexception.DukeException; +package duchess.logic.parser; + +import duchess.logic.commands.AddDeadlineCommand; +import duchess.logic.commands.AddEventCommand; +import duchess.logic.commands.AddTodoCommand; +import duchess.logic.commands.ByeCommand; +import duchess.logic.commands.Command; +import duchess.logic.commands.DeleteCommand; +import duchess.logic.commands.DoneCommand; +import duchess.logic.commands.FindCommand; +import duchess.logic.commands.ListCommand; +import duchess.logic.commands.ReminderCommand; +import duchess.logic.commands.SnoozeCommand; +import duchess.logic.commands.ViewScheduleCommand; +import duchess.logic.commands.exceptions.DukeException; import java.util.Arrays; import java.util.List; -class Parser { +public class Parser { /** * Returns the command to execute after parsing user input. * diff --git a/src/main/java/duke/command/Schedule.java b/src/main/java/duchess/model/Schedule.java similarity index 98% rename from src/main/java/duke/command/Schedule.java rename to src/main/java/duchess/model/Schedule.java index 0e650f6a77..4bc492ac38 100644 --- a/src/main/java/duke/command/Schedule.java +++ b/src/main/java/duchess/model/Schedule.java @@ -1,4 +1,4 @@ -package duke.command; +package duchess.model; import java.text.SimpleDateFormat; import java.util.Date; diff --git a/src/main/java/duke/command/Storage.java b/src/main/java/duchess/storage/Storage.java similarity index 93% rename from src/main/java/duke/command/Storage.java rename to src/main/java/duchess/storage/Storage.java index 14e9a3d8d7..5a61f66c18 100644 --- a/src/main/java/duke/command/Storage.java +++ b/src/main/java/duchess/storage/Storage.java @@ -1,7 +1,7 @@ -package duke.command; +package duchess.storage; -import duke.dukeexception.DukeException; -import duke.task.TaskList; +import duchess.logic.commands.exceptions.DukeException; +import duchess.storage.task.TaskList; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; diff --git a/src/main/java/duke/task/Deadline.java b/src/main/java/duchess/storage/task/Deadline.java similarity index 94% rename from src/main/java/duke/task/Deadline.java rename to src/main/java/duchess/storage/task/Deadline.java index 766e9964e8..14e5c74272 100644 --- a/src/main/java/duke/task/Deadline.java +++ b/src/main/java/duchess/storage/task/Deadline.java @@ -1,7 +1,7 @@ -package duke.task; +package duchess.storage.task; -import duke.dukeexception.DukeException; -import duke.command.Schedule; +import duchess.logic.commands.exceptions.DukeException; +import duchess.model.Schedule; import java.text.ParseException; import java.text.SimpleDateFormat; diff --git a/src/main/java/duke/task/Event.java b/src/main/java/duchess/storage/task/Event.java similarity index 97% rename from src/main/java/duke/task/Event.java rename to src/main/java/duchess/storage/task/Event.java index 1d8de544ab..3fb7b3787b 100644 --- a/src/main/java/duke/task/Event.java +++ b/src/main/java/duchess/storage/task/Event.java @@ -1,7 +1,7 @@ -package duke.task; +package duchess.storage.task; -import duke.dukeexception.DukeException; -import duke.command.Schedule; +import duchess.logic.commands.exceptions.DukeException; +import duchess.model.Schedule; import java.text.ParseException; import java.text.SimpleDateFormat; diff --git a/src/main/java/duke/task/Snoozeable.java b/src/main/java/duchess/storage/task/Snoozeable.java similarity index 63% rename from src/main/java/duke/task/Snoozeable.java rename to src/main/java/duchess/storage/task/Snoozeable.java index b7868a1286..175d344ad8 100644 --- a/src/main/java/duke/task/Snoozeable.java +++ b/src/main/java/duchess/storage/task/Snoozeable.java @@ -1,4 +1,4 @@ -package duke.task; +package duchess.storage.task; public interface Snoozeable { void snooze(); diff --git a/src/main/java/duke/task/Task.java b/src/main/java/duchess/storage/task/Task.java similarity index 89% rename from src/main/java/duke/task/Task.java rename to src/main/java/duchess/storage/task/Task.java index dd95efc516..b738ac8a22 100644 --- a/src/main/java/duke/task/Task.java +++ b/src/main/java/duchess/storage/task/Task.java @@ -1,6 +1,6 @@ -package duke.task; +package duchess.storage.task; -import duke.command.Schedule; +import duchess.model.Schedule; import java.io.Serializable; import java.util.Date; diff --git a/src/main/java/duke/task/TaskList.java b/src/main/java/duchess/storage/task/TaskList.java similarity index 97% rename from src/main/java/duke/task/TaskList.java rename to src/main/java/duchess/storage/task/TaskList.java index 5cecd85130..1169863dae 100644 --- a/src/main/java/duke/task/TaskList.java +++ b/src/main/java/duchess/storage/task/TaskList.java @@ -1,4 +1,4 @@ -package duke.task; +package duchess.storage.task; import java.io.Serializable; import java.util.ArrayList; diff --git a/src/main/java/duke/task/Todo.java b/src/main/java/duchess/storage/task/Todo.java similarity index 88% rename from src/main/java/duke/task/Todo.java rename to src/main/java/duchess/storage/task/Todo.java index a4bda67079..b3744190e2 100644 --- a/src/main/java/duke/task/Todo.java +++ b/src/main/java/duchess/storage/task/Todo.java @@ -1,7 +1,7 @@ -package duke.task; +package duchess.storage.task; -import duke.dukeexception.DukeException; -import duke.command.Schedule; +import duchess.logic.commands.exceptions.DukeException; +import duchess.model.Schedule; import java.util.Date; import java.util.List; diff --git a/src/main/java/duke/command/Ui.java b/src/main/java/duchess/ui/Ui.java similarity index 98% rename from src/main/java/duke/command/Ui.java rename to src/main/java/duchess/ui/Ui.java index d776413ca5..f7082e3ccd 100644 --- a/src/main/java/duke/command/Ui.java +++ b/src/main/java/duchess/ui/Ui.java @@ -1,7 +1,8 @@ -package duke.command; +package duchess.ui; -import duke.task.Snoozeable; -import duke.task.Task; +import duchess.model.Schedule; +import duchess.storage.task.Snoozeable; +import duchess.storage.task.Task; import java.util.List; import java.util.Scanner; diff --git a/src/test/java/DeadlineTest.java b/src/test/java/DeadlineTest.java index 06924170e2..3a1376d6f7 100644 --- a/src/test/java/DeadlineTest.java +++ b/src/test/java/DeadlineTest.java @@ -1,6 +1,6 @@ -import duke.dukeexception.DukeException; -import duke.task.Deadline; -import duke.task.Snoozeable; +import duchess.logic.commands.exceptions.DukeException; +import duchess.storage.task.Deadline; +import duchess.storage.task.Snoozeable; import org.junit.jupiter.api.Test; import java.util.List; diff --git a/src/test/java/DetectAnomaliesTest.java b/src/test/java/DetectAnomaliesTest.java index a5a8cbf06f..f009e33418 100644 --- a/src/test/java/DetectAnomaliesTest.java +++ b/src/test/java/DetectAnomaliesTest.java @@ -1,7 +1,7 @@ -import duke.dukeexception.DukeException; -import duke.task.Event; -import duke.task.Task; -import duke.task.TaskList; +import duchess.logic.commands.exceptions.DukeException; +import duchess.storage.task.Event; +import duchess.storage.task.Task; +import duchess.storage.task.TaskList; import org.junit.jupiter.api.Test; import java.util.List; diff --git a/src/test/java/ReminderCommandTest.java b/src/test/java/ReminderCommandTest.java index 44804b04e1..5cc01272f8 100644 --- a/src/test/java/ReminderCommandTest.java +++ b/src/test/java/ReminderCommandTest.java @@ -1,54 +1,55 @@ -import duke.command.AddDeadlineCommand; -import duke.command.ReminderCommand; -import duke.command.Storage; -import duke.command.Ui; -import duke.dukeexception.DukeException; -import duke.task.TaskList; -import org.junit.jupiter.api.Test; - -import java.util.Arrays; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertTrue; - -public class ReminderCommandTest { - - @Test - public void testExecuteWithoutDeadlines() throws DukeException { - String filename = "text_file"; - TaskList taskList = new TaskList(); - Ui ui = new Ui(); - Storage storage = new Storage(filename); - - assertTrue(taskList.getTasks().size() == 0); - ReminderCommand reminderCommand = new ReminderCommand(); - - assertTrue(taskList.getTasks().size() == 0); - } - - @Test - public void testExecuteWithDeadlines() throws DukeException { - String firstDeadline = "deadline homework assignment /by 23/12/2019 1800"; - String secondDeadline = "deadline school project tasks /by 01/11/2020 0900"; - - String filename = "text_file"; - TaskList taskList = new TaskList(); - Ui ui = new Ui(); - Storage storage = new Storage(filename); - Parser parser = new Parser(); - - // Adding the firstDeadline - List firstWords = Arrays.asList(firstDeadline.split(" ")); - AddDeadlineCommand addDeadlineCommand = new AddDeadlineCommand(firstWords); - addDeadlineCommand.execute(taskList, ui, storage); - - - // Adding the firstDeadline - List secondWords = Arrays.asList(firstDeadline.split(" ")); - addDeadlineCommand = new AddDeadlineCommand(secondWords); - addDeadlineCommand.execute(taskList, ui, storage); - - assertTrue(taskList.getTasks().size() == 2); - ReminderCommand reminderCommand = new ReminderCommand(); - } -} +import duchess.logic.commands.AddDeadlineCommand; +import duchess.logic.commands.ReminderCommand; +import duchess.logic.parser.Parser; +import duchess.storage.Storage; +import duchess.ui.Ui; +import duchess.logic.commands.exceptions.DukeException; +import duchess.storage.task.TaskList; +import org.junit.jupiter.api.Test; + +import java.util.Arrays; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class ReminderCommandTest { + + @Test + public void testExecuteWithoutDeadlines() throws DukeException { + String filename = "text_file"; + TaskList taskList = new TaskList(); + Ui ui = new Ui(); + Storage storage = new Storage(filename); + + assertTrue(taskList.getTasks().size() == 0); + ReminderCommand reminderCommand = new ReminderCommand(); + + assertTrue(taskList.getTasks().size() == 0); + } + + @Test + public void testExecuteWithDeadlines() throws DukeException { + String firstDeadline = "deadline homework assignment /by 23/12/2019 1800"; + String secondDeadline = "deadline school project tasks /by 01/11/2020 0900"; + + String filename = "text_file"; + TaskList taskList = new TaskList(); + Ui ui = new Ui(); + Storage storage = new Storage(filename); + Parser parser = new Parser(); + + // Adding the firstDeadline + List firstWords = Arrays.asList(firstDeadline.split(" ")); + AddDeadlineCommand addDeadlineCommand = new AddDeadlineCommand(firstWords); + addDeadlineCommand.execute(taskList, ui, storage); + + + // Adding the firstDeadline + List secondWords = Arrays.asList(firstDeadline.split(" ")); + addDeadlineCommand = new AddDeadlineCommand(secondWords); + addDeadlineCommand.execute(taskList, ui, storage); + + assertTrue(taskList.getTasks().size() == 2); + ReminderCommand reminderCommand = new ReminderCommand(); + } +} diff --git a/src/test/java/TaskListTest.java b/src/test/java/TaskListTest.java index 8c1cce115f..ab21dd2e9e 100644 --- a/src/test/java/TaskListTest.java +++ b/src/test/java/TaskListTest.java @@ -1,7 +1,7 @@ -import duke.dukeexception.DukeException; -import duke.task.Task; -import duke.task.TaskList; -import duke.task.Todo; +import duchess.logic.commands.exceptions.DukeException; +import duchess.storage.task.Task; +import duchess.storage.task.TaskList; +import duchess.storage.task.Todo; import org.junit.jupiter.api.Test; import java.util.List; diff --git a/src/test/java/TaskTest.java b/src/test/java/TaskTest.java index 8871bf05e0..a1f673081b 100644 --- a/src/test/java/TaskTest.java +++ b/src/test/java/TaskTest.java @@ -1,5 +1,5 @@ -import duke.dukeexception.DukeException; -import duke.task.Deadline; +import duchess.logic.commands.exceptions.DukeException; +import duchess.storage.task.Deadline; import org.junit.jupiter.api.Test; import java.util.List; diff --git a/src/test/java/ViewScheduleCommandTest.java b/src/test/java/ViewScheduleCommandTest.java index 45d3e733ef..4ddd1422b8 100644 --- a/src/test/java/ViewScheduleCommandTest.java +++ b/src/test/java/ViewScheduleCommandTest.java @@ -1,6 +1,6 @@ -import duke.command.Schedule; -import duke.command.ViewScheduleCommand; -import duke.dukeexception.DukeException; +import duchess.model.Schedule; +import duchess.logic.commands.ViewScheduleCommand; +import duchess.logic.commands.exceptions.DukeException; import org.junit.jupiter.api.Test; import java.text.ParseException;