Skip to content

Commit

Permalink
Merge pull request AY2324S1-CS2103T-W08-1#108 from AustinHuang1203/te…
Browse files Browse the repository at this point in the history
…stsbranch

Add testcases for clear and confirmation
  • Loading branch information
AustinHuang1203 authored Oct 24, 2023
2 parents ef12d24 + c408dac commit bca8e56
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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);
}
*/




Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}

}

0 comments on commit bca8e56

Please sign in to comment.