diff --git a/src/test/java/seedu/address/logic/commands/CreateDeadlineCommandTest.java b/src/test/java/seedu/address/logic/commands/CreateDeadlineCommandTest.java index b53cd333884..e3847b909e7 100644 --- a/src/test/java/seedu/address/logic/commands/CreateDeadlineCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/CreateDeadlineCommandTest.java @@ -43,7 +43,7 @@ public void setup() { @Test public void constructor_nullArgs_throwsNullPointerException() { - assertThrows(NullPointerException.class, () -> new CreateDeadlineCommand(null, null)); + assertThrows(NullPointerException.class, () -> new CreateDeadlineCommand(null, null, null)); } @Test @@ -60,7 +60,7 @@ public void execute_deadlineForStudentAccepted_addSuccessful() throws InvalidPat TaskOperation operation = expectedModel.taskOperation(absoluteTargetPath); operation.addTask(toBeAdded); - CreateDeadlineCommand command = new CreateDeadlineCommand(absoluteTargetPath, toBeAdded); + CreateDeadlineCommand command = new CreateDeadlineCommand(absoluteTargetPath, toBeAdded, Category.NONE); String expectedMessage = String.format(CreateDeadlineCommand.MESSAGE_SUCCESS, toBeAdded); @@ -78,7 +78,7 @@ public void execute_deadlineForAllStudentsInGroupAccepted_addSuccessful() ChildOperation operation = expectedModel.groupChildOperation(absoluteTargetPath); operation.addTaskToAllChildren(toBeAdded, 1); - CreateDeadlineCommand command = new CreateDeadlineCommand(absoluteTargetPath, toBeAdded, "allStu"); + CreateDeadlineCommand command = new CreateDeadlineCommand(absoluteTargetPath, toBeAdded, Category.ALLSTU); String expectedMessage = CreateDeadlineCommand.MESSAGE_SUCCESS_ALL_STUDENTS; assertCommandSuccess(command, model, expectedMessage, expectedModel); @@ -90,7 +90,7 @@ public void execute_deadlineForAllGroupsInRootAccepted_addSuccessful() ChildOperation operation = expectedModel.rootChildOperation(); operation.addTaskToAllChildren(toBeAdded, 1); - CreateDeadlineCommand command = new CreateDeadlineCommand(rootPath, toBeAdded, "allGrp"); + CreateDeadlineCommand command = new CreateDeadlineCommand(rootPath, toBeAdded, Category.ALLGRP); String expectedMessage = CreateDeadlineCommand.MESSAGE_SUCCESS_ALL_GROUPS; assertCommandSuccess(command, model, expectedMessage, expectedModel); @@ -109,7 +109,7 @@ public void execute_duplicateDeadline_throwsCommandException() throws InvalidPat TaskOperation operation = model.taskOperation(absoluteTargetPath); operation.addTask(toBeAdded); - CreateDeadlineCommand command = new CreateDeadlineCommand(absoluteTargetPath, toBeAdded); + CreateDeadlineCommand command = new CreateDeadlineCommand(absoluteTargetPath, toBeAdded, Category.NONE); String expectedMessage = CreateDeadlineCommand.MESSAGE_DUPLICATE_DEADLINE_TASK; assertCommandFailure(command, model, expectedMessage); @@ -117,14 +117,17 @@ public void execute_duplicateDeadline_throwsCommandException() throws InvalidPat @Test public void equals() { - CreateDeadlineCommand createDeadlineCommand1 = new CreateDeadlineCommand(rootPath, TypicalTasks.DEADLINE_1); - CreateDeadlineCommand createDeadlineCommand2 = new CreateDeadlineCommand(rootPath, TypicalTasks.DEADLINE_2); + CreateDeadlineCommand createDeadlineCommand1 = new CreateDeadlineCommand( + rootPath, TypicalTasks.DEADLINE_1, Category.NONE); + CreateDeadlineCommand createDeadlineCommand2 = new CreateDeadlineCommand( + rootPath, TypicalTasks.DEADLINE_2, Category.NONE); // same object -> returns true assertEquals(createDeadlineCommand1, createDeadlineCommand1); // same values -> returns true - CreateDeadlineCommand createDeadlineCommand1Copy = new CreateDeadlineCommand(rootPath, TypicalTasks.DEADLINE_1); + CreateDeadlineCommand createDeadlineCommand1Copy = new CreateDeadlineCommand( + rootPath, TypicalTasks.DEADLINE_1, Category.NONE); assertEquals(createDeadlineCommand1, createDeadlineCommand1Copy); // different types -> returns false @@ -139,7 +142,8 @@ public void equals() { @Test public void toStringMethod() { - CreateDeadlineCommand createDeadlineCommand = new CreateDeadlineCommand(rootPath, TypicalTasks.DEADLINE_1); + CreateDeadlineCommand createDeadlineCommand = new CreateDeadlineCommand( + rootPath, TypicalTasks.DEADLINE_1, Category.NONE); String expected = CreateDeadlineCommand.class.getCanonicalName() + "{toCreateDeadline=" + TypicalTasks.DEADLINE_1 + "}"; assertEquals(expected, createDeadlineCommand.toString()); diff --git a/src/test/java/seedu/address/logic/commands/CreateTodoCommandTest.java b/src/test/java/seedu/address/logic/commands/CreateTodoCommandTest.java index 3d943ddfa46..f5f02a0be33 100644 --- a/src/test/java/seedu/address/logic/commands/CreateTodoCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/CreateTodoCommandTest.java @@ -48,7 +48,7 @@ public void setup() { @Test public void constructor_nullRelativePathAndTodo_throwsNullPointerException() { - assertThrows(NullPointerException.class, () -> new CreateTodoCommand(null, null)); + assertThrows(NullPointerException.class, () -> new CreateTodoCommand(null, null, null)); } @Test @@ -62,7 +62,7 @@ public void execute_todoForAllStudentsInGroupAccepted_addSuccessful() ChildOperation operation = expectedModel.groupChildOperation(absoluteTargetPath); operation.addTaskToAllChildren(toBeAdded, 1); - CreateTodoCommand command = new CreateTodoCommand(absoluteTargetPath, toBeAdded, "allStu"); + CreateTodoCommand command = new CreateTodoCommand(absoluteTargetPath, toBeAdded, Category.ALLSTU); String expectedMessage = MESSAGE_SUCCESS_ALL_STUDENTS; assertCommandSuccess(command, model, expectedMessage, expectedModel); @@ -74,7 +74,7 @@ public void execute_deadlineForAllGroupsInRootAccepted_addSuccessful() ChildOperation operation = expectedModel.rootChildOperation(); operation.addTaskToAllChildren(toBeAdded, 1); - CreateTodoCommand command = new CreateTodoCommand(rootPath, toBeAdded, "allGrp"); + CreateTodoCommand command = new CreateTodoCommand(rootPath, toBeAdded, Category.ALLGRP); String expectedMessage = MESSAGE_SUCCESS_ALL_GROUPS; assertCommandSuccess(command, model, expectedMessage, expectedModel); @@ -94,7 +94,7 @@ public void execute_createTodoTask_success() throws CommandException, InvalidPat TaskOperation operation = expectedModel.taskOperation(absoluteTargetPath); operation.addTask(toBeAdded); - CreateTodoCommand command = new CreateTodoCommand(absoluteTargetPath, toBeAdded); + CreateTodoCommand command = new CreateTodoCommand(absoluteTargetPath, toBeAdded, Category.NONE); String expectedMessage = String.format(MESSAGE_SUCCESS, absoluteTargetPath); assertCommandSuccess(command, model, expectedMessage, expectedModel); @@ -114,7 +114,7 @@ public void execute_duplicateTodoTask_throwCommandException() throws InvalidPath TaskOperation operation = model.taskOperation(absoluteTargetPath); operation.addTask(toBeAdded); - CreateTodoCommand command = new CreateTodoCommand(absoluteTargetPath, toBeAdded); + CreateTodoCommand command = new CreateTodoCommand(absoluteTargetPath, toBeAdded, Category.NONE); String expectedMessage = MESSAGE_DUPLICATE_TODO_TASK_STUDENT; assertCommandFailure(command, model, expectedMessage); @@ -122,14 +122,14 @@ public void execute_duplicateTodoTask_throwCommandException() throws InvalidPath @Test public void equals() { - CreateTodoCommand createTodoCommand1 = new CreateTodoCommand(rootPath, TODO_1); - CreateTodoCommand createTodoCommand2 = new CreateTodoCommand(rootPath, TODO_2); + CreateTodoCommand createTodoCommand1 = new CreateTodoCommand(rootPath, TODO_1, Category.NONE); + CreateTodoCommand createTodoCommand2 = new CreateTodoCommand(rootPath, TODO_2, Category.NONE); // same object -> returns true assertEquals(createTodoCommand1, createTodoCommand1); // same values -> returns true - CreateTodoCommand createDeadlineCommand1Copy = new CreateTodoCommand(rootPath, TODO_1); + CreateTodoCommand createDeadlineCommand1Copy = new CreateTodoCommand(rootPath, TODO_1, Category.NONE); assertEquals(createTodoCommand1, createDeadlineCommand1Copy); // different types -> returns false @@ -144,7 +144,7 @@ public void equals() { @Test public void toStringMethod() { - CreateTodoCommand createDeadlineCommand = new CreateTodoCommand(rootPath, TODO_1); + CreateTodoCommand createDeadlineCommand = new CreateTodoCommand(rootPath, TODO_1, Category.NONE); String expected = CreateTodoCommand.class.getCanonicalName() + "{toCreateTodo=" + TODO_1 + "}"; assertEquals(expected, createDeadlineCommand.toString()); diff --git a/src/test/java/seedu/address/logic/parser/CreateDeadlineCommandParserTest.java b/src/test/java/seedu/address/logic/parser/CreateDeadlineCommandParserTest.java index f62a021b0e1..99e668779ed 100644 --- a/src/test/java/seedu/address/logic/parser/CreateDeadlineCommandParserTest.java +++ b/src/test/java/seedu/address/logic/parser/CreateDeadlineCommandParserTest.java @@ -9,6 +9,7 @@ import org.junit.jupiter.api.Test; +import seedu.address.logic.commands.Category; import seedu.address.logic.commands.CommandTestUtil; import seedu.address.logic.commands.CreateDeadlineCommand; import seedu.address.model.task.Deadline; @@ -23,7 +24,8 @@ public void parse_allFieldsPresent_success() { CommandTestUtil.getValidRootAbsolutePath(), new CreateDeadlineCommand( CommandTestUtil.getValidGroupAbsolutePath(), - new Deadline(VALID_TASK_DESC, CommandTestUtil.getValidDateTime()))); + new Deadline(VALID_TASK_DESC, CommandTestUtil.getValidDateTime()), + Category.NONE)); } @Test @@ -33,6 +35,7 @@ public void parse_allFieldsPresentWithCategory_success() { CommandTestUtil.getValidRootAbsolutePath(), new CreateDeadlineCommand( CommandTestUtil.getValidGroupAbsolutePath(), - new Deadline(VALID_TASK_DESC, CommandTestUtil.getValidDateTime()), "allStu")); + new Deadline(VALID_TASK_DESC, CommandTestUtil.getValidDateTime()), + Category.ALLSTU)); } } diff --git a/src/test/java/seedu/address/logic/parser/CreateTodoCommandParserTest.java b/src/test/java/seedu/address/logic/parser/CreateTodoCommandParserTest.java index 1eecaad24c5..3964336b11c 100644 --- a/src/test/java/seedu/address/logic/parser/CreateTodoCommandParserTest.java +++ b/src/test/java/seedu/address/logic/parser/CreateTodoCommandParserTest.java @@ -8,6 +8,7 @@ import org.junit.jupiter.api.Test; +import seedu.address.logic.commands.Category; import seedu.address.logic.commands.CommandTestUtil; import seedu.address.logic.commands.CreateTodoCommand; import seedu.address.model.task.ToDo; @@ -20,7 +21,8 @@ public void parse_allFieldsPresent_success() { assertParseSuccess(parser, VALID_STUDENT_DIR_PREAMBLE + TASK_DESC_DESC, CommandTestUtil.getValidRootAbsolutePath(), - new CreateTodoCommand(CommandTestUtil.getValidStudentAbsolutePath(), new ToDo(VALID_TASK_DESC))); + new CreateTodoCommand(CommandTestUtil.getValidStudentAbsolutePath(), new ToDo(VALID_TASK_DESC), + Category.NONE)); } @Test @@ -29,6 +31,7 @@ public void parse_allFieldsPresentWithCatergory_success() { VALID_STUDENT_DIR_PREAMBLE + TASK_DESC_DESC + VALID_CATEGORY_STUDENT, CommandTestUtil.getValidRootAbsolutePath(), new CreateTodoCommand(CommandTestUtil.getValidStudentAbsolutePath(), - new ToDo(VALID_TASK_DESC), "allStu")); + new ToDo(VALID_TASK_DESC), + Category.ALLSTU)); } }