Skip to content

Commit

Permalink
Update test cases for delete tag command
Browse files Browse the repository at this point in the history
  • Loading branch information
CYX22222003 committed Oct 21, 2024
1 parent b4028e8 commit 59d535f
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package seedu.address.logic.commands;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static seedu.address.logic.commands.CommandTestUtil.assertCommandFailure;
import static seedu.address.logic.commands.CommandTestUtil.assertCommandSuccess;
import static seedu.address.testutil.TypicalIndexes.INDEX_FIRST_PERSON;
import static seedu.address.testutil.TypicalIndexes.INDEX_SECOND_PERSON;
import static seedu.address.testutil.TypicalPersons.FRIEND_TAG;
import static seedu.address.testutil.TypicalPersons.OWES_MONEY_TAG;
import static seedu.address.testutil.TypicalPersons.getTypicalCampusConnect;
Expand Down Expand Up @@ -44,17 +46,25 @@ public void execute_validIndexPersonList_success() {
}

@Test
public void execute_InvalidIndexPersonList_failure() {
public void execute_invalidIndexPersonList_throwsCommandException() {
Index outOfBoundIndex = Index.fromOneBased(model.getFilteredPersonList().size() + 1);
DeleteTagCommand deleteTagCommand = new DeleteTagCommand(outOfBoundIndex, new Tag(DEFAULT_TAG));
assertCommandFailure(deleteTagCommand, model, Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX);
}

@Test
public void execute_PersonHasNoTag_failure() {
public void execute_personHasNoTag_throwsCommandException() {
Index lastIndex = Index.fromOneBased(model.getFilteredPersonList().size());
DeleteTagCommand deleteTagCommand = new DeleteTagCommand(lastIndex, new Tag(DEFAULT_TAG));
assertCommandFailure(deleteTagCommand, model, Messages.MESSAGE_NO_TAG);
}

@Test
public void equals() {
DeleteTagCommand deleteTagCommandA = new DeleteTagCommand(INDEX_FIRST_PERSON, new Tag(DEFAULT_TAG));
DeleteTagCommand deleteTagCommandB = new DeleteTagCommand(INDEX_SECOND_PERSON, new Tag(DEFAULT_TAG));

assertFalse(deleteTagCommandA.equals(deleteTagCommandB));
}

}

0 comments on commit 59d535f

Please sign in to comment.