diff --git a/src/main/java/seedu/address/logic/commands/RemarkCommand.java b/src/main/java/seedu/address/logic/commands/RemarkCommand.java index f5f3a0d6d55..e6886626292 100644 --- a/src/main/java/seedu/address/logic/commands/RemarkCommand.java +++ b/src/main/java/seedu/address/logic/commands/RemarkCommand.java @@ -78,7 +78,7 @@ public CommandResult execute(Model model) throws CommandException { */ private String generateSuccessMessage(Person personToEdit) { String message = !remark.value.isEmpty() ? MESSAGE_ADD_REMARK_SUCCESS : MESSAGE_DELETE_REMARK_SUCCESS; - return String.format(message, personToEdit); + return String.format(message, personToEdit.getName().toString()); } @Override diff --git a/src/test/java/seedu/address/logic/commands/RemarkCommandTest.java b/src/test/java/seedu/address/logic/commands/RemarkCommandTest.java index e90139524ea..300dedfe292 100644 --- a/src/test/java/seedu/address/logic/commands/RemarkCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/RemarkCommandTest.java @@ -39,7 +39,8 @@ public void execute_addRemarkUnfilteredList_success() { Person firstPerson = model.getFilteredPersonList().get(INDEX_FIRST_PERSON.getZeroBased()); Person editedPerson = new PersonBuilder(firstPerson).withRemark(REMARK_STUB).build(); RemarkCommand remarkCommand = new RemarkCommand(NRIC_FIRST_PERSON, new Remark(editedPerson.getRemark().value)); - String expectedMessage = String.format(RemarkCommand.MESSAGE_ADD_REMARK_SUCCESS, editedPerson); + String expectedMessage = String.format(RemarkCommand.MESSAGE_ADD_REMARK_SUCCESS, + editedPerson.getName().toString()); Model expectedModel = new ModelManager(new AddressBook(model.getAddressBook()), new UserPrefs()); expectedModel.setPerson(firstPerson, editedPerson); assertCommandSuccess(remarkCommand, model, expectedMessage, expectedModel); @@ -52,7 +53,8 @@ public void execute_deleteRemarkUnfilteredList_success() { RemarkCommand remarkCommand = new RemarkCommand(NRIC_FIRST_PERSON, new Remark(editedPerson.getRemark().toString())); - String expectedMessage = String.format(RemarkCommand.MESSAGE_DELETE_REMARK_SUCCESS, editedPerson); + String expectedMessage = String.format(RemarkCommand.MESSAGE_DELETE_REMARK_SUCCESS, + editedPerson.getName().toString()); Model expectedModel = new ModelManager(new AddressBook(model.getAddressBook()), new UserPrefs()); expectedModel.setPerson(firstPerson, editedPerson); @@ -67,7 +69,8 @@ public void execute_filteredList_success() { RemarkCommand remarkCommand = new RemarkCommand(NRIC_FIRST_PERSON, new Remark(editedPerson.getRemark().value)); - String expectedMessage = String.format(RemarkCommand.MESSAGE_ADD_REMARK_SUCCESS, editedPerson); + String expectedMessage = String.format(RemarkCommand.MESSAGE_ADD_REMARK_SUCCESS, + editedPerson.getName().toString()); Model expectedModel = new ModelManager(new AddressBook(model.getAddressBook()), new UserPrefs()); expectedModel.setPerson(firstPerson, editedPerson);