Skip to content

Commit

Permalink
Merge pull request #95 from reidenong/branch-remark-response
Browse files Browse the repository at this point in the history
Fix remark CLI message
  • Loading branch information
itsnotsherm authored Nov 7, 2024
2 parents 073ffcf + 4f43c6d commit 3750a2c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);

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

0 comments on commit 3750a2c

Please sign in to comment.