From 73cef602c2866f751a64b5c2ad75441da9563bee Mon Sep 17 00:00:00 2001 From: DanzaSeah Date: Thu, 24 Oct 2024 13:06:35 +0800 Subject: [PATCH] Resolve all comments in PR --- .../{ListTaskCommand.java => ListTasksCommand.java} | 4 ++-- .../seedu/address/logic/parser/AddressBookParser.java | 4 ++-- ...tTaskCommandTest.java => ListTasksCommandTest.java} | 10 +++++----- .../address/logic/parser/AddressBookParserTest.java | 6 +++--- src/test/java/seedu/address/model/task/DateTest.java | 6 ++++++ 5 files changed, 18 insertions(+), 12 deletions(-) rename src/main/java/seedu/address/logic/commands/{ListTaskCommand.java => ListTasksCommand.java} (85%) rename src/test/java/seedu/address/logic/commands/{ListTaskCommandTest.java => ListTasksCommandTest.java} (74%) diff --git a/src/main/java/seedu/address/logic/commands/ListTaskCommand.java b/src/main/java/seedu/address/logic/commands/ListTasksCommand.java similarity index 85% rename from src/main/java/seedu/address/logic/commands/ListTaskCommand.java rename to src/main/java/seedu/address/logic/commands/ListTasksCommand.java index 765b11e3b8a..f684ebe820f 100644 --- a/src/main/java/seedu/address/logic/commands/ListTaskCommand.java +++ b/src/main/java/seedu/address/logic/commands/ListTasksCommand.java @@ -10,9 +10,9 @@ /** * Lists all tasks in the address book to the user. */ -public class ListTaskCommand extends Command { +public class ListTasksCommand extends Command { - public static final String COMMAND_WORD = "list-task"; + public static final String COMMAND_WORD = "list-tasks"; public static final String MESSAGE_SUCCESS = "Listed all tasks"; diff --git a/src/main/java/seedu/address/logic/parser/AddressBookParser.java b/src/main/java/seedu/address/logic/parser/AddressBookParser.java index 5f29af0842f..f3084842d71 100644 --- a/src/main/java/seedu/address/logic/parser/AddressBookParser.java +++ b/src/main/java/seedu/address/logic/parser/AddressBookParser.java @@ -20,7 +20,7 @@ import seedu.address.logic.commands.ExitCommand; import seedu.address.logic.commands.HelpCommand; import seedu.address.logic.commands.ListCommand; -import seedu.address.logic.commands.ListTaskCommand; +import seedu.address.logic.commands.ListTasksCommand; import seedu.address.logic.commands.TagCommand; import seedu.address.logic.commands.UntagCommand; import seedu.address.logic.commands.findcommand.FindCommand; @@ -89,7 +89,7 @@ public Command parseCommand(String userInput) throws ParseException { case AssignWeddingCommand.COMMAND_WORD -> new AssignWeddingCommandParser().parse(arguments); case UnassignWeddingCommand.COMMAND_WORD -> new UnassignWeddingCommandParser().parse(arguments); case CreateTaskCommand.COMMAND_WORD -> new CreateTaskCommandParser().parse(arguments); - case ListTaskCommand.COMMAND_WORD -> new ListTaskCommand(); + case ListTasksCommand.COMMAND_WORD -> new ListTasksCommand(); case DeleteTaskCommand.COMMAND_WORD -> new DeleteTaskCommandParser().parse(arguments); default -> { logger.finer("This user input caused a ParseException: " + userInput); diff --git a/src/test/java/seedu/address/logic/commands/ListTaskCommandTest.java b/src/test/java/seedu/address/logic/commands/ListTasksCommandTest.java similarity index 74% rename from src/test/java/seedu/address/logic/commands/ListTaskCommandTest.java rename to src/test/java/seedu/address/logic/commands/ListTasksCommandTest.java index 2cf49c52730..59bc783c51e 100644 --- a/src/test/java/seedu/address/logic/commands/ListTaskCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/ListTasksCommandTest.java @@ -15,7 +15,7 @@ /** * Contains integration tests (interaction with the Model) and unit tests for ListTaskCommand. */ -public class ListTaskCommandTest { +public class ListTasksCommandTest { private Model model; private Model expectedModel; @@ -28,14 +28,14 @@ public void setUp() { @Test public void execute_listIsNotFiltered_showsSameList() { - CommandResult actualCommandResult = new ListTaskCommand().execute(model); - assertCommandSuccess(new ListTaskCommand(), model, actualCommandResult, expectedModel); + CommandResult actualCommandResult = new ListTasksCommand().execute(model); + assertCommandSuccess(new ListTasksCommand(), model, actualCommandResult, expectedModel); } @Test public void execute_listIsFiltered_showsEverything() { showTaskAtIndex(model, INDEX_FIRST); // Filters the task list to show only the first task - CommandResult actualCommandResult = new ListTaskCommand().execute(model); - assertCommandSuccess(new ListTaskCommand(), model, actualCommandResult, expectedModel); + CommandResult actualCommandResult = new ListTasksCommand().execute(model); + assertCommandSuccess(new ListTasksCommand(), model, actualCommandResult, expectedModel); } } diff --git a/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java b/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java index 2b3b87939b0..a02800d46f4 100644 --- a/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java +++ b/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java @@ -26,7 +26,7 @@ import seedu.address.logic.commands.ExitCommand; import seedu.address.logic.commands.HelpCommand; import seedu.address.logic.commands.ListCommand; -import seedu.address.logic.commands.ListTaskCommand; +import seedu.address.logic.commands.ListTasksCommand; import seedu.address.logic.commands.TagCommand; import seedu.address.logic.commands.UntagCommand; import seedu.address.logic.commands.findcommand.FindCommand; @@ -202,8 +202,8 @@ public void parseCommand_listWeddings() throws Exception { @Test public void parseCommand_listTask() throws Exception { - assertTrue(parser.parseCommand(ListTaskCommand.COMMAND_WORD) instanceof ListTaskCommand); - assertTrue(parser.parseCommand(ListTaskCommand.COMMAND_WORD + " 3") instanceof ListTaskCommand); + assertTrue(parser.parseCommand(ListTasksCommand.COMMAND_WORD) instanceof ListTasksCommand); + assertTrue(parser.parseCommand(ListTasksCommand.COMMAND_WORD + " 3") instanceof ListTasksCommand); } @Test diff --git a/src/test/java/seedu/address/model/task/DateTest.java b/src/test/java/seedu/address/model/task/DateTest.java index f5d1c6a6941..98c42fd96f9 100644 --- a/src/test/java/seedu/address/model/task/DateTest.java +++ b/src/test/java/seedu/address/model/task/DateTest.java @@ -70,6 +70,12 @@ public void equals_sameDate_returnsTrue() { assertTrue(date1.equals(date2)); } + @Test + public void equals_self_returnsTrue() { + Date date1 = new Date(VALID_DATE); + assertTrue(date1.equals(date1)); + } + @Test public void equals_differentDate_returnsFalse() { Date date1 = new Date(VALID_DATE);