From 2d6c2ebbfe92e98fff8ef1848c70352c1b167629 Mon Sep 17 00:00:00 2001 From: tingxuanp Date: Thu, 24 Oct 2024 14:49:54 +0800 Subject: [PATCH] Resolve merge conflicts and test cases --- .../logic/commands/AddVendorCommandTest.java | 5 ++++ .../commands/AssignVendorCommandTest.java | 28 +++++++++---------- .../commands/UnassignVendorCommandTest.java | 14 +++++----- .../parser/AssignVendorComandParserTest.java | 6 ++-- .../UnassignVendorCommandParserTest.java | 6 ++-- 5 files changed, 32 insertions(+), 27 deletions(-) diff --git a/src/test/java/seedu/address/logic/commands/AddVendorCommandTest.java b/src/test/java/seedu/address/logic/commands/AddVendorCommandTest.java index 518c11e7423..d8a2703765f 100644 --- a/src/test/java/seedu/address/logic/commands/AddVendorCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/AddVendorCommandTest.java @@ -214,6 +214,11 @@ public void updateFilteredPersonListByTag(Predicate tag) { throw new AssertionError("This method should not be called."); } + @Override + public void updateFilteredPersonListByWedding(Predicate weddingPredicate) { + throw new AssertionError("This method should not be called."); + } + @Override public boolean hasVendor(Person person) { throw new AssertionError("This method should not be called."); diff --git a/src/test/java/seedu/address/logic/commands/AssignVendorCommandTest.java b/src/test/java/seedu/address/logic/commands/AssignVendorCommandTest.java index 902e0a20bbc..7d3e6537603 100644 --- a/src/test/java/seedu/address/logic/commands/AssignVendorCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/AssignVendorCommandTest.java @@ -6,8 +6,8 @@ import static seedu.address.logic.commands.CommandTestUtil.assertCommandFailure; import static seedu.address.logic.commands.CommandTestUtil.assertCommandSuccess; import static seedu.address.logic.commands.CommandTestUtil.showPersonAtIndex; -import static seedu.address.testutil.TypicalIndexes.INDEX_FIRST_PERSON; -import static seedu.address.testutil.TypicalIndexes.INDEX_SECOND_PERSON; +import static seedu.address.testutil.TypicalIndexes.INDEX_FIRST; +import static seedu.address.testutil.TypicalIndexes.INDEX_SECOND; import static seedu.address.testutil.TypicalPersons.getTypicalAddressBook; import org.junit.jupiter.api.Disabled; @@ -26,8 +26,8 @@ public class AssignVendorCommandTest { @Test public void execute_validIndexUnfilteredList_success() { - Person personToAssign = model.getFilteredPersonList().get(INDEX_FIRST_PERSON.getZeroBased()); - AssignVendorCommand assignVendorCommand = new AssignVendorCommand(INDEX_FIRST_PERSON); + Person personToAssign = model.getFilteredPersonList().get(INDEX_FIRST.getZeroBased()); + AssignVendorCommand assignVendorCommand = new AssignVendorCommand(INDEX_FIRST); String expectedMessage = String.format(AssignVendorCommand.MESSAGE_SUCCESS, personToAssign.getName()); @@ -48,10 +48,10 @@ public void execute_invalidIndexUnfilteredList_throwsCommandException() { @Test public void execute_duplicateVendor_throwsCommandException() { - Person personToAssign = model.getFilteredPersonList().get(INDEX_FIRST_PERSON.getZeroBased()); + Person personToAssign = model.getFilteredPersonList().get(INDEX_FIRST.getZeroBased()); model.assignVendor(personToAssign); - AssignVendorCommand assignVendorCommand = new AssignVendorCommand(INDEX_FIRST_PERSON); + AssignVendorCommand assignVendorCommand = new AssignVendorCommand(INDEX_FIRST); assertCommandFailure(assignVendorCommand, model, String.format(AssignVendorCommand.MESSAGE_DUPLICATE_VENDOR, personToAssign.getName())); } @@ -59,10 +59,10 @@ public void execute_duplicateVendor_throwsCommandException() { @Disabled // disabled, to find why it doesnt work @Test public void execute_validIndexFilteredList_success() { - showPersonAtIndex(model, INDEX_FIRST_PERSON); + showPersonAtIndex(model, INDEX_FIRST); - Person personToAssign = model.getFilteredPersonList().get(INDEX_FIRST_PERSON.getZeroBased()); - AssignVendorCommand assignVendorCommand = new AssignVendorCommand(INDEX_FIRST_PERSON); + Person personToAssign = model.getFilteredPersonList().get(INDEX_FIRST.getZeroBased()); + AssignVendorCommand assignVendorCommand = new AssignVendorCommand(INDEX_FIRST); String expectedMessage = String.format(AssignVendorCommand.MESSAGE_SUCCESS, personToAssign.getName()); @@ -74,9 +74,9 @@ public void execute_validIndexFilteredList_success() { @Test public void execute_invalidIndexFilteredList_throwsCommandException() { - showPersonAtIndex(model, INDEX_FIRST_PERSON); + showPersonAtIndex(model, INDEX_FIRST); - Index outOfBoundIndex = INDEX_SECOND_PERSON; + Index outOfBoundIndex = INDEX_SECOND; // ensures that outOfBoundIndex is still in bounds of address book list assertTrue(outOfBoundIndex.getZeroBased() < model.getAddressBook().getPersonList().size()); @@ -87,14 +87,14 @@ public void execute_invalidIndexFilteredList_throwsCommandException() { @Test public void equals() { - AssignVendorCommand assignVendorFirstCommand = new AssignVendorCommand(INDEX_FIRST_PERSON); - AssignVendorCommand assignVendorSecondCommand = new AssignVendorCommand(INDEX_SECOND_PERSON); + AssignVendorCommand assignVendorFirstCommand = new AssignVendorCommand(INDEX_FIRST); + AssignVendorCommand assignVendorSecondCommand = new AssignVendorCommand(INDEX_SECOND); // same object -> returns true assertTrue(assignVendorFirstCommand.equals(assignVendorFirstCommand)); // same values -> returns true - AssignVendorCommand assignVendorFirstCommandCopy = new AssignVendorCommand(INDEX_FIRST_PERSON); + AssignVendorCommand assignVendorFirstCommandCopy = new AssignVendorCommand(INDEX_FIRST); assertTrue(assignVendorFirstCommand.equals(assignVendorFirstCommandCopy)); // different types -> returns false diff --git a/src/test/java/seedu/address/logic/commands/UnassignVendorCommandTest.java b/src/test/java/seedu/address/logic/commands/UnassignVendorCommandTest.java index cab19b5b2b8..dbbae2daaf0 100644 --- a/src/test/java/seedu/address/logic/commands/UnassignVendorCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/UnassignVendorCommandTest.java @@ -5,8 +5,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static seedu.address.logic.commands.CommandTestUtil.assertCommandFailure; import static seedu.address.logic.commands.CommandTestUtil.showPersonAtIndex; -import static seedu.address.testutil.TypicalIndexes.INDEX_FIRST_PERSON; -import static seedu.address.testutil.TypicalIndexes.INDEX_SECOND_PERSON; +import static seedu.address.testutil.TypicalIndexes.INDEX_FIRST; +import static seedu.address.testutil.TypicalIndexes.INDEX_SECOND; import static seedu.address.testutil.TypicalPersons.getTypicalAddressBook; import org.junit.jupiter.api.Test; @@ -24,9 +24,9 @@ public class UnassignVendorCommandTest { // To add: test cases to check for validity @Test public void execute_invalidIndexFilteredList_throwsCommandException() { - showPersonAtIndex(model, INDEX_FIRST_PERSON); + showPersonAtIndex(model, INDEX_FIRST); - Index outOfBoundIndex = INDEX_SECOND_PERSON; + Index outOfBoundIndex = INDEX_SECOND; assertTrue(outOfBoundIndex.getZeroBased() < model.getAddressBook().getPersonList().size()); UnassignVendorCommand unassignVendorCommand = new UnassignVendorCommand(outOfBoundIndex); @@ -36,14 +36,14 @@ public void execute_invalidIndexFilteredList_throwsCommandException() { @Test public void equals() { - UnassignVendorCommand unassignVendorFirstCommand = new UnassignVendorCommand(INDEX_FIRST_PERSON); - UnassignVendorCommand unassignVendorSecondCommand = new UnassignVendorCommand(INDEX_SECOND_PERSON); + UnassignVendorCommand unassignVendorFirstCommand = new UnassignVendorCommand(INDEX_FIRST); + UnassignVendorCommand unassignVendorSecondCommand = new UnassignVendorCommand(INDEX_SECOND); // same object -> returns true assertTrue(unassignVendorFirstCommand.equals(unassignVendorFirstCommand)); // same values -> returns true - UnassignVendorCommand unassignVendorFirstCommandCopy = new UnassignVendorCommand(INDEX_FIRST_PERSON); + UnassignVendorCommand unassignVendorFirstCommandCopy = new UnassignVendorCommand(INDEX_FIRST); assertTrue(unassignVendorFirstCommand.equals(unassignVendorFirstCommandCopy)); // different types -> returns false diff --git a/src/test/java/seedu/address/logic/parser/AssignVendorComandParserTest.java b/src/test/java/seedu/address/logic/parser/AssignVendorComandParserTest.java index b3fa7451149..15bce6c1386 100644 --- a/src/test/java/seedu/address/logic/parser/AssignVendorComandParserTest.java +++ b/src/test/java/seedu/address/logic/parser/AssignVendorComandParserTest.java @@ -3,7 +3,7 @@ import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; import static seedu.address.logic.parser.CommandParserTestUtil.assertParseFailure; import static seedu.address.logic.parser.CommandParserTestUtil.assertParseSuccess; -import static seedu.address.testutil.TypicalIndexes.INDEX_FIRST_PERSON; +import static seedu.address.testutil.TypicalIndexes.INDEX_FIRST; import org.junit.jupiter.api.Test; @@ -15,12 +15,12 @@ public class AssignVendorComandParserTest { @Test public void parse_validArgs_returnsAssignVendorCommand() { - assertParseSuccess(parser, "1", new AssignVendorCommand(INDEX_FIRST_PERSON)); + assertParseSuccess(parser, "1", new AssignVendorCommand(INDEX_FIRST)); } @Test public void parse_validArgsWithTrailingSpace_returnsAssignVendorCommand() { - assertParseSuccess(parser, "1 \t", new AssignVendorCommand(INDEX_FIRST_PERSON)); + assertParseSuccess(parser, "1 \t", new AssignVendorCommand(INDEX_FIRST)); } @Test diff --git a/src/test/java/seedu/address/logic/parser/UnassignVendorCommandParserTest.java b/src/test/java/seedu/address/logic/parser/UnassignVendorCommandParserTest.java index bc1e4396744..32785b71fe9 100644 --- a/src/test/java/seedu/address/logic/parser/UnassignVendorCommandParserTest.java +++ b/src/test/java/seedu/address/logic/parser/UnassignVendorCommandParserTest.java @@ -3,7 +3,7 @@ import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; import static seedu.address.logic.parser.CommandParserTestUtil.assertParseFailure; import static seedu.address.logic.parser.CommandParserTestUtil.assertParseSuccess; -import static seedu.address.testutil.TypicalIndexes.INDEX_FIRST_PERSON; +import static seedu.address.testutil.TypicalIndexes.INDEX_FIRST; import org.junit.jupiter.api.Test; @@ -15,12 +15,12 @@ public class UnassignVendorCommandParserTest { @Test public void parse_validArgs_returnsUnassignVendorCommand() { - assertParseSuccess(parser, "1", new UnassignVendorCommand(INDEX_FIRST_PERSON)); + assertParseSuccess(parser, "1", new UnassignVendorCommand(INDEX_FIRST)); } @Test public void parse_validArgsWithTrailingSpace_returnsUnassignVendorCommand() { - assertParseSuccess(parser, "1 \n", new UnassignVendorCommand(INDEX_FIRST_PERSON)); + assertParseSuccess(parser, "1 \n", new UnassignVendorCommand(INDEX_FIRST)); } @Test