Skip to content

Commit

Permalink
Retain changes to read person list
Browse files Browse the repository at this point in the history
  • Loading branch information
NatLeong committed Apr 9, 2024
1 parent 3e5fde4 commit a89e666
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions src/main/java/seedu/address/logic/commands/ReadCommand.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package seedu.address.logic.commands;

import static java.util.Objects.requireNonNull;
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS;

import seedu.address.commons.util.ToStringBuilder;
import seedu.address.logic.Messages;
Expand Down Expand Up @@ -46,7 +45,6 @@ public CommandResult execute(Model model) throws CommandException {

model.updateFilteredPersonList(new NricContainsKeywordsPredicate(nric.toString()));
Person readPerson = model.getFilteredPersonList().get(0);
model.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS);

return new CommandResult(String.format(MESSAGE_READ_PERSON_SUCCESS, Messages.format(readPerson)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import static seedu.address.logic.commands.CommandTestUtil.assertCommandFailure;
import static seedu.address.logic.commands.CommandTestUtil.assertCommandSuccess;
import static seedu.address.logic.commands.ReadCommand.MESSAGE_READ_PERSON_SUCCESS;
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS;
import static seedu.address.testutil.TypicalPersons.ALICE;
import static seedu.address.testutil.TypicalPersons.getTypicalAddressBook;

Expand All @@ -18,6 +17,7 @@
import seedu.address.model.ModelManager;
import seedu.address.model.UserPrefs;
import seedu.address.model.person.Nric;
import seedu.address.model.person.NricContainsKeywordsPredicate;

public class ReadCommandTest {

Expand All @@ -27,7 +27,7 @@ public class ReadCommandTest {
void execute_validNric_success() {
String expectedMessage = String.format(MESSAGE_READ_PERSON_SUCCESS, Messages.format(ALICE));
ReadCommand command = new ReadCommand(ALICE.getNric());
expectedModel.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS);
expectedModel.updateFilteredPersonList(new NricContainsKeywordsPredicate(ALICE.getNric().toString()));
assertCommandSuccess(command, model, expectedMessage, expectedModel);
}

Expand Down

0 comments on commit a89e666

Please sign in to comment.