Skip to content

Commit

Permalink
Modified delete command to only show name of employee in log and modi…
Browse files Browse the repository at this point in the history
…fied tests
  • Loading branch information
remuslum committed Oct 11, 2023
1 parent 6a3a32e commit 28a438e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main/java/seedu/address/logic/commands/DeleteCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

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

0 comments on commit 28a438e

Please sign in to comment.