Skip to content

Commit

Permalink
Resolve merge conflicts and test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
tingxuanp committed Oct 24, 2024
1 parent fa86adc commit 2d6c2eb
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,11 @@ public void updateFilteredPersonListByTag(Predicate<Tag> tag) {
throw new AssertionError("This method should not be called.");
}

@Override
public void updateFilteredPersonListByWedding(Predicate<Wedding> 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.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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());
Expand All @@ -48,21 +48,21 @@ 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()));
}

@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());
Expand All @@ -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());

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

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

Expand All @@ -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
Expand Down

0 comments on commit 2d6c2eb

Please sign in to comment.