diff --git a/src/test/java/seedu/staffsnap/logic/commands/ClearCommandTest.java b/src/test/java/seedu/staffsnap/logic/commands/ClearCommandTest.java index 2b90f11d2b5..909555888cb 100644 --- a/src/test/java/seedu/staffsnap/logic/commands/ClearCommandTest.java +++ b/src/test/java/seedu/staffsnap/logic/commands/ClearCommandTest.java @@ -1,16 +1,18 @@ package seedu.staffsnap.logic.commands; import static seedu.staffsnap.logic.commands.CommandTestUtil.assertCommandSuccess; -//import static seedu.staffsnap.testutil.TypicalApplicants.getTypicalApplicantBook; +import static seedu.staffsnap.testutil.TypicalApplicants.getTypicalApplicantBook; import org.junit.jupiter.api.Test; -//import seedu.staffsnap.model.ApplicantBook; +import seedu.staffsnap.logic.commands.exceptions.CommandException; +import seedu.staffsnap.model.ApplicantBook; import seedu.staffsnap.model.Model; import seedu.staffsnap.model.ModelManager; -//import seedu.staffsnap.model.UserPrefs; +import seedu.staffsnap.model.UserPrefs; public class ClearCommandTest { + private Command confirmStub = new ConfirmationCommand(); @Test @@ -20,16 +22,17 @@ public void execute_emptyApplicantBook_success() { assertCommandSuccess(new ClearCommand(), model, ClearCommand.MESSAGE_SUCCESS, expectedModel); } - /* + @Test - public void execute_nonEmptyApplicantBook_success() { + public void execute_nonEmptyApplicantBook_success() throws CommandException { Model model = new ModelManager(getTypicalApplicantBook(), new UserPrefs()); Model expectedModel = new ModelManager(getTypicalApplicantBook(), new UserPrefs()); expectedModel.setApplicantBook(new ApplicantBook()); + confirmStub.execute(model); assertCommandSuccess(new ClearCommand(), model, ClearCommand.MESSAGE_SUCCESS, expectedModel); } - */ + diff --git a/src/test/java/seedu/staffsnap/logic/commands/ConfirmationCommandTest.java b/src/test/java/seedu/staffsnap/logic/commands/ConfirmationCommandTest.java index a0aca315793..46233b33a73 100644 --- a/src/test/java/seedu/staffsnap/logic/commands/ConfirmationCommandTest.java +++ b/src/test/java/seedu/staffsnap/logic/commands/ConfirmationCommandTest.java @@ -1,22 +1,20 @@ package seedu.staffsnap.logic.commands; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static seedu.staffsnap.testutil.TypicalApplicants.getUnsortedApplicantBook; - -import java.util.Objects; +import static seedu.staffsnap.logic.commands.CommandTestUtil.assertCommandSuccess; import org.junit.jupiter.api.Test; import seedu.staffsnap.model.Model; import seedu.staffsnap.model.ModelManager; -import seedu.staffsnap.model.UserPrefs; -class ConfirmationCommandTest { +public class ConfirmationCommandTest { @Test - void execute() { - Model model = new ModelManager(getUnsortedApplicantBook(), new UserPrefs()); - ConfirmationCommand command = new ConfirmationCommand(); - assertTrue(Objects.equals(command.execute(model), new CommandResult(ConfirmationCommand.CONFIRM))); + public void execute_emptyApplicantBook_success() { + Model model = new ModelManager(); + Model expectedModel = new ModelManager(); + + assertCommandSuccess(new ConfirmationCommand(), model, ConfirmationCommand.CONFIRM, expectedModel); } + }