From 79652343b8267aa2e1d926ca954de578bc634279 Mon Sep 17 00:00:00 2001 From: swtan346 Date: Mon, 8 Apr 2024 13:08:01 +0800 Subject: [PATCH 1/3] Change persons to person --- src/main/java/seedu/address/logic/Messages.java | 1 + .../java/seedu/address/logic/commands/FindCommand.java | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/seedu/address/logic/Messages.java b/src/main/java/seedu/address/logic/Messages.java index 9245dc138c0..8a411f12665 100644 --- a/src/main/java/seedu/address/logic/Messages.java +++ b/src/main/java/seedu/address/logic/Messages.java @@ -16,6 +16,7 @@ public class Messages { public static final String MESSAGE_INVALID_COMMAND_FORMAT = "Invalid command format! \n%1$s"; public static final String MESSAGE_INVALID_PERSON_DISPLAYED_INDEX = "The person index provided is invalid"; public static final String MESSAGE_PERSONS_LISTED_OVERVIEW = "%1$d persons listed!"; + public static final String MESSAGE_PERSON_LISTED_OVERVIEW = "%1$d person listed!"; public static final String MESSAGE_DUPLICATE_FIELDS = "Multiple values specified for the following single-valued field(s): "; /** diff --git a/src/main/java/seedu/address/logic/commands/FindCommand.java b/src/main/java/seedu/address/logic/commands/FindCommand.java index 20a601f2084..fb324502650 100644 --- a/src/main/java/seedu/address/logic/commands/FindCommand.java +++ b/src/main/java/seedu/address/logic/commands/FindCommand.java @@ -35,8 +35,11 @@ public FindCommand(Predicate predicate) { public CommandResult execute(Model model) { requireNonNull(model); model.updateFilteredPersonList(predicate); - return new CommandResult( - String.format(Messages.MESSAGE_PERSONS_LISTED_OVERVIEW, model.getFilteredPersonList().size())); + int listSize = model.getFilteredPersonList().size(); + if (listSize < 2) { + return new CommandResult(String.format(Messages.MESSAGE_PERSON_LISTED_OVERVIEW, listSize)); + } + return new CommandResult(String.format(Messages.MESSAGE_PERSONS_LISTED_OVERVIEW, listSize)); } @Override From bd8533271ffa1f2027b266fedb162d6496b28d3b Mon Sep 17 00:00:00 2001 From: swtan346 Date: Mon, 8 Apr 2024 13:09:45 +0800 Subject: [PATCH 2/3] Add spacing --- src/main/java/seedu/address/model/person/Ic.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/seedu/address/model/person/Ic.java b/src/main/java/seedu/address/model/person/Ic.java index 3b950c35e98..e3286bd1090 100644 --- a/src/main/java/seedu/address/model/person/Ic.java +++ b/src/main/java/seedu/address/model/person/Ic.java @@ -8,7 +8,7 @@ */ public class Ic { public static final String MESSAGE_CONSTRAINTS = - "ICs starts with a capital letter, followed by a 7 digit number and ends with a capital letter." + "ICs starts with a capital letter, followed by a 7 digit number and ends with a capital letter. " + "It should not be blank."; // singapore regex for ic From 4b296529a826c7395a5002c3fd1e7dee3b2644b1 Mon Sep 17 00:00:00 2001 From: swtan346 Date: Mon, 8 Apr 2024 13:15:28 +0800 Subject: [PATCH 3/3] Modify test case --- .../java/seedu/address/logic/commands/FindCommandTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/java/seedu/address/logic/commands/FindCommandTest.java b/src/test/java/seedu/address/logic/commands/FindCommandTest.java index b8b7dbba91a..29a006a8129 100644 --- a/src/test/java/seedu/address/logic/commands/FindCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/FindCommandTest.java @@ -4,6 +4,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import static seedu.address.logic.Messages.MESSAGE_PERSONS_LISTED_OVERVIEW; +import static seedu.address.logic.Messages.MESSAGE_PERSON_LISTED_OVERVIEW; import static seedu.address.logic.commands.CommandTestUtil.assertCommandSuccess; import static seedu.address.testutil.TypicalPersons.CARL; import static seedu.address.testutil.TypicalPersons.ELLE; @@ -56,7 +57,7 @@ public void equals() { @Test public void execute_zeroKeywords_noPersonFound() { - String expectedMessage = String.format(MESSAGE_PERSONS_LISTED_OVERVIEW, 0); + String expectedMessage = String.format(MESSAGE_PERSON_LISTED_OVERVIEW, 0); NameContainsKeywordsPredicate predicate = preparePredicate(" "); FindCommand command = new FindCommand(predicate); expectedModel.updateFilteredPersonList(predicate);