From 28a438ebde38640ad6c25182638e78a685c0b7d0 Mon Sep 17 00:00:00 2001 From: remuslum <57741494+remuslum@users.noreply.github.com> Date: Wed, 11 Oct 2023 21:44:36 +0800 Subject: [PATCH] Modified delete command to only show name of employee in log and modified tests --- src/main/java/seedu/address/logic/commands/DeleteCommand.java | 4 ++-- .../java/seedu/address/logic/commands/DeleteCommandTest.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/seedu/address/logic/commands/DeleteCommand.java b/src/main/java/seedu/address/logic/commands/DeleteCommand.java index 568c61b08b6..e6b130c7700 100644 --- a/src/main/java/seedu/address/logic/commands/DeleteCommand.java +++ b/src/main/java/seedu/address/logic/commands/DeleteCommand.java @@ -23,7 +23,7 @@ public class DeleteCommand extends Command { + "Parameters: INDEX (must be a positive integer)\n" + "Example: " + COMMAND_WORD + " 1"; - public static final String MESSAGE_DELETE_PERSON_SUCCESS = "Deleted employee: %1$s"; + public static final String MESSAGE_DELETE_PERSON_SUCCESS = "Employee successfully deleted: %1$s"; private final Index targetIndex; @@ -42,7 +42,7 @@ public CommandResult execute(Model model) throws CommandException { Person personToDelete = lastShownList.get(targetIndex.getZeroBased()); model.deletePerson(personToDelete); - return new CommandResult(String.format(MESSAGE_DELETE_PERSON_SUCCESS, Messages.format(personToDelete))); + return new CommandResult(String.format(MESSAGE_DELETE_PERSON_SUCCESS, personToDelete.getName())); } @Override diff --git a/src/test/java/seedu/address/logic/commands/DeleteCommandTest.java b/src/test/java/seedu/address/logic/commands/DeleteCommandTest.java index b6f332eabca..ee369c3e510 100644 --- a/src/test/java/seedu/address/logic/commands/DeleteCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/DeleteCommandTest.java @@ -33,7 +33,7 @@ public void execute_validIndexUnfilteredList_success() { DeleteCommand deleteCommand = new DeleteCommand(INDEX_FIRST_PERSON); String expectedMessage = String.format(DeleteCommand.MESSAGE_DELETE_PERSON_SUCCESS, - Messages.format(personToDelete)); + personToDelete.getName()); ModelManager expectedModel = new ModelManager(model.getAddressBook(), new UserPrefs()); expectedModel.deletePerson(personToDelete); @@ -57,7 +57,7 @@ public void execute_validIndexFilteredList_success() { DeleteCommand deleteCommand = new DeleteCommand(INDEX_FIRST_PERSON); String expectedMessage = String.format(DeleteCommand.MESSAGE_DELETE_PERSON_SUCCESS, - Messages.format(personToDelete)); + personToDelete.getName()); Model expectedModel = new ModelManager(model.getAddressBook(), new UserPrefs()); expectedModel.deletePerson(personToDelete);