From 6b908de75c0cdb3099dcf9b3700decc57124012b Mon Sep 17 00:00:00 2001 From: sk2001git <122198303+sk2001git@users.noreply.github.com> Date: Sun, 15 Oct 2023 23:58:09 +0800 Subject: [PATCH] Add view command Added new panel as well as view command to allow full view of remark --- src/main/java/seedu/address/logic/Logic.java | 7 ++ .../seedu/address/logic/LogicManager.java | 9 +++ .../address/logic/commands/CommandResult.java | 31 +++++++- .../address/logic/commands/ExitCommand.java | 2 +- .../address/logic/commands/HelpCommand.java | 2 +- .../address/logic/commands/ViewCommand.java | 73 +++++++++++++++++++ .../logic/parser/AddressBookParser.java | 4 + .../seedu/address/logic/parser/CliSyntax.java | 2 + .../logic/parser/ViewCommandParser.java | 36 +++++++++ src/main/java/seedu/address/model/Model.java | 12 +++ .../seedu/address/model/ModelManager.java | 17 +++++ .../java/seedu/address/ui/MainWindow.java | 24 ++++++ .../address/ui/PersonInformationPanel.java | 54 ++++++++++++++ src/main/resources/view/MainWindow.fxml | 25 ++++++- .../view/PersonInformationPanel.fxml | 28 +++++++ .../logic/commands/AddCommandTest.java | 13 ++++ .../logic/commands/CommandResultTest.java | 18 +++-- .../logic/commands/ExitCommandTest.java | 2 +- .../logic/commands/HelpCommandTest.java | 2 +- .../logic/parser/FindCommandParserTest.java | 4 +- 20 files changed, 345 insertions(+), 20 deletions(-) create mode 100644 src/main/java/seedu/address/logic/commands/ViewCommand.java create mode 100644 src/main/java/seedu/address/logic/parser/ViewCommandParser.java create mode 100644 src/main/java/seedu/address/ui/PersonInformationPanel.java create mode 100644 src/main/resources/view/PersonInformationPanel.fxml diff --git a/src/main/java/seedu/address/logic/Logic.java b/src/main/java/seedu/address/logic/Logic.java index 92cd8fa605a..f43aaeaaec0 100644 --- a/src/main/java/seedu/address/logic/Logic.java +++ b/src/main/java/seedu/address/logic/Logic.java @@ -4,6 +4,7 @@ import javafx.collections.ObservableList; import seedu.address.commons.core.GuiSettings; +import seedu.address.commons.core.index.Index; import seedu.address.logic.commands.CommandResult; import seedu.address.logic.commands.exceptions.CommandException; import seedu.address.logic.parser.exceptions.ParseException; @@ -47,4 +48,10 @@ public interface Logic { * Set the user prefs' GUI settings. */ void setGuiSettings(GuiSettings guiSettings); + + /** + * Returns the last viewed person index. + */ + Index getLastViewedPersonIndex(); + } diff --git a/src/main/java/seedu/address/logic/LogicManager.java b/src/main/java/seedu/address/logic/LogicManager.java index 5aa3b91c7d0..1c07c2d6e29 100644 --- a/src/main/java/seedu/address/logic/LogicManager.java +++ b/src/main/java/seedu/address/logic/LogicManager.java @@ -8,6 +8,7 @@ import javafx.collections.ObservableList; import seedu.address.commons.core.GuiSettings; import seedu.address.commons.core.LogsCenter; +import seedu.address.commons.core.index.Index; import seedu.address.logic.commands.Command; import seedu.address.logic.commands.CommandResult; import seedu.address.logic.commands.exceptions.CommandException; @@ -27,6 +28,7 @@ public class LogicManager implements Logic { public static final String FILE_OPS_PERMISSION_ERROR_FORMAT = "Could not save data to file %s due to insufficient permissions to write to the file or the folder."; + private final Logger logger = LogsCenter.getLogger(LogicManager.class); private final Model model; @@ -71,6 +73,11 @@ public ObservableList getFilteredPersonList() { return model.getFilteredPersonList(); } + @Override + public Index getLastViewedPersonIndex() { + return model.getLastViewedPersonIndex(); + } + @Override public Path getAddressBookFilePath() { return model.getAddressBookFilePath(); @@ -85,4 +92,6 @@ public GuiSettings getGuiSettings() { public void setGuiSettings(GuiSettings guiSettings) { model.setGuiSettings(guiSettings); } + + } diff --git a/src/main/java/seedu/address/logic/commands/CommandResult.java b/src/main/java/seedu/address/logic/commands/CommandResult.java index 249b6072d0d..0581b98a615 100644 --- a/src/main/java/seedu/address/logic/commands/CommandResult.java +++ b/src/main/java/seedu/address/logic/commands/CommandResult.java @@ -19,13 +19,16 @@ public class CommandResult { /** The application should exit. */ private final boolean exit; + private final boolean isView; + /** * Constructs a {@code CommandResult} with the specified fields. */ - public CommandResult(String feedbackToUser, boolean showHelp, boolean exit) { + public CommandResult(String feedbackToUser, boolean showHelp, boolean exit, boolean isView) { this.feedbackToUser = requireNonNull(feedbackToUser); this.showHelp = showHelp; this.exit = exit; + this.isView = isView; } /** @@ -33,9 +36,19 @@ public CommandResult(String feedbackToUser, boolean showHelp, boolean exit) { * and other fields set to their default value. */ public CommandResult(String feedbackToUser) { - this(feedbackToUser, false, false); + this(feedbackToUser, false, false, false); + } + + /** + * Constructs a {@code CommandResult} with the specified fields. + * @param feedbackToUser feedback to user + * @param isView whether to show the view + */ + public CommandResult(String feedbackToUser, boolean isView) { + this(feedbackToUser, false, false, isView); } + public String getFeedbackToUser() { return feedbackToUser; } @@ -48,6 +61,14 @@ public boolean isExit() { return exit; } + /** + * Returns true if the command result is to show the view. + * @return true if the command result is to show the view + */ + public boolean isView() { + return isView; + } + @Override public boolean equals(Object other) { if (other == this) { @@ -62,12 +83,13 @@ public boolean equals(Object other) { CommandResult otherCommandResult = (CommandResult) other; return feedbackToUser.equals(otherCommandResult.feedbackToUser) && showHelp == otherCommandResult.showHelp - && exit == otherCommandResult.exit; + && exit == otherCommandResult.exit + && isView == otherCommandResult.isView; } @Override public int hashCode() { - return Objects.hash(feedbackToUser, showHelp, exit); + return Objects.hash(feedbackToUser, showHelp, exit, isView); } @Override @@ -76,6 +98,7 @@ public String toString() { .add("feedbackToUser", feedbackToUser) .add("showHelp", showHelp) .add("exit", exit) + .add("isView", isView) .toString(); } diff --git a/src/main/java/seedu/address/logic/commands/ExitCommand.java b/src/main/java/seedu/address/logic/commands/ExitCommand.java index 3dd85a8ba90..acac9a21374 100644 --- a/src/main/java/seedu/address/logic/commands/ExitCommand.java +++ b/src/main/java/seedu/address/logic/commands/ExitCommand.java @@ -13,7 +13,7 @@ public class ExitCommand extends Command { @Override public CommandResult execute(Model model) { - return new CommandResult(MESSAGE_EXIT_ACKNOWLEDGEMENT, false, true); + return new CommandResult(MESSAGE_EXIT_ACKNOWLEDGEMENT, false, true, false); } } diff --git a/src/main/java/seedu/address/logic/commands/HelpCommand.java b/src/main/java/seedu/address/logic/commands/HelpCommand.java index bf824f91bd0..07d26e2a23c 100644 --- a/src/main/java/seedu/address/logic/commands/HelpCommand.java +++ b/src/main/java/seedu/address/logic/commands/HelpCommand.java @@ -16,6 +16,6 @@ public class HelpCommand extends Command { @Override public CommandResult execute(Model model) { - return new CommandResult(SHOWING_HELP_MESSAGE, true, false); + return new CommandResult(SHOWING_HELP_MESSAGE, true, false, false); } } diff --git a/src/main/java/seedu/address/logic/commands/ViewCommand.java b/src/main/java/seedu/address/logic/commands/ViewCommand.java new file mode 100644 index 00000000000..bf413ed96ea --- /dev/null +++ b/src/main/java/seedu/address/logic/commands/ViewCommand.java @@ -0,0 +1,73 @@ +package seedu.address.logic.commands; + +import static seedu.address.commons.util.CollectionUtil.requireAllNonNull; +import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS; + +import java.util.List; + +import seedu.address.commons.core.index.Index; +import seedu.address.logic.Messages; +import seedu.address.logic.commands.exceptions.CommandException; +import seedu.address.model.Model; +import seedu.address.model.person.Person; +public class ViewCommand extends Command { + public static final String COMMAND_WORD = "view"; + + public static final String MESSAGE_USAGE = COMMAND_WORD + + ": Views the details of the person identified " + + "by the index number used in the last person listing. \n" + + "Parameters: INDEX (must be a positive integer) \n" + + "Example: " + COMMAND_WORD + " 1 "; + + public static final String MESSAGE_ARGUMENTS = "Index: %1$d"; + public static final String MESSAGE_SUCCESSFUL_VIEW = "Full-view shown for Person: %1$s"; + + private final Index index; + + /** + * + * @param index of the person in the filtered person list to view + */ + public ViewCommand(Index index) { + requireAllNonNull(index); + this.index = index; + } + + @Override + public CommandResult execute(Model model) throws CommandException { + List lastShownList = model.getFilteredPersonList(); + model.setLastViewedPersonIndex(index); + + if (index.getZeroBased() >= lastShownList.size()) { + throw new CommandException(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX); + } + + Person personToView = lastShownList.get(index.getZeroBased()); + return new CommandResult(generateSuccessMessage(personToView), true); + } + + /** + * Generates a command execution success message for viewing {@code personToView}. + */ + private String generateSuccessMessage(Person personToView) { + return String.format(MESSAGE_SUCCESSFUL_VIEW, Messages.format(personToView)); + } + + private void updateUI() { + + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + // instanceof handles nulls + if (!(other instanceof ViewCommand)) { + return false; + } + + ViewCommand v = (ViewCommand) other; + return index.equals(v.index); + } +} diff --git a/src/main/java/seedu/address/logic/parser/AddressBookParser.java b/src/main/java/seedu/address/logic/parser/AddressBookParser.java index 1bfb947c147..e97c9423de4 100644 --- a/src/main/java/seedu/address/logic/parser/AddressBookParser.java +++ b/src/main/java/seedu/address/logic/parser/AddressBookParser.java @@ -18,6 +18,7 @@ import seedu.address.logic.commands.HelpCommand; import seedu.address.logic.commands.ListCommand; import seedu.address.logic.commands.RemarkCommand; +import seedu.address.logic.commands.ViewCommand; import seedu.address.logic.parser.exceptions.ParseException; /** @@ -81,6 +82,9 @@ public Command parseCommand(String userInput) throws ParseException { case RemarkCommand.COMMAND_WORD: return new RemarkCommandParser().parse(arguments); + case ViewCommand.COMMAND_WORD: + return new ViewCommandParser().parse(arguments); + default: logger.finer("This user input caused a ParseException: " + userInput); throw new ParseException(MESSAGE_UNKNOWN_COMMAND); diff --git a/src/main/java/seedu/address/logic/parser/CliSyntax.java b/src/main/java/seedu/address/logic/parser/CliSyntax.java index 4906de012e5..75911ac5a4a 100644 --- a/src/main/java/seedu/address/logic/parser/CliSyntax.java +++ b/src/main/java/seedu/address/logic/parser/CliSyntax.java @@ -12,6 +12,8 @@ public class CliSyntax { public static final Prefix PREFIX_ADDRESS = new Prefix("a/"); public static final Prefix PREFIX_REMARK = new Prefix("r/"); + + public static final Prefix PREFIX_VIEW = new Prefix("v/"); public static final Prefix PREFIX_TAG = new Prefix("t/"); public static final Prefix PREFIX_SORT = new Prefix("so/"); public static final Prefix PREFIX_STATUS = new Prefix("st/"); diff --git a/src/main/java/seedu/address/logic/parser/ViewCommandParser.java b/src/main/java/seedu/address/logic/parser/ViewCommandParser.java new file mode 100644 index 00000000000..34173cd4e68 --- /dev/null +++ b/src/main/java/seedu/address/logic/parser/ViewCommandParser.java @@ -0,0 +1,36 @@ +package seedu.address.logic.parser; + +import static java.util.Objects.requireNonNull; +import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; +import static seedu.address.logic.parser.CliSyntax.PREFIX_VIEW; + +import seedu.address.commons.core.index.Index; +import seedu.address.commons.exceptions.IllegalValueException; +import seedu.address.logic.commands.ViewCommand; +import seedu.address.logic.parser.exceptions.ParseException; + +/** + * Parses input arguments and creates a new {@code ViewCommand} object + * + */ +public class ViewCommandParser implements Parser { + + /** + * Parses the given {@code String} of arguments in the context of the {@code ViewCommand} + * and returns a {@code ViewCommand} object for execution. + * @throws ParseException if the user input does not conform the expected format + */ + public ViewCommand parse(String args) throws ParseException { + requireNonNull(args); + ArgumentMultimap argMultimap = ArgumentTokenizer.tokenize(args, PREFIX_VIEW); + + Index index; + try { + index = ParserUtil.parseIndex(argMultimap.getPreamble()); + } catch (IllegalValueException ive) { + throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, ViewCommand.MESSAGE_USAGE), ive); + } + + return new ViewCommand(index); + } +} diff --git a/src/main/java/seedu/address/model/Model.java b/src/main/java/seedu/address/model/Model.java index b9b4e2d2f29..33b9269255e 100644 --- a/src/main/java/seedu/address/model/Model.java +++ b/src/main/java/seedu/address/model/Model.java @@ -6,6 +6,7 @@ import javafx.collections.ObservableList; import seedu.address.commons.core.GuiSettings; +import seedu.address.commons.core.index.Index; import seedu.address.model.person.Person; /** @@ -94,4 +95,15 @@ public interface Model { */ void updateFilteredPersonList(Predicate predicate1, Predicate predicate2); + + /** + * Returns the Index of the last view command called. + */ + Index getLastViewedPersonIndex(); + + /** + * Sets the Index of the last view command called. + */ + void setLastViewedPersonIndex(Index index); + } diff --git a/src/main/java/seedu/address/model/ModelManager.java b/src/main/java/seedu/address/model/ModelManager.java index 8ceb665f204..9f268d5e39e 100644 --- a/src/main/java/seedu/address/model/ModelManager.java +++ b/src/main/java/seedu/address/model/ModelManager.java @@ -14,6 +14,7 @@ import javafx.collections.transformation.FilteredList; import seedu.address.commons.core.GuiSettings; import seedu.address.commons.core.LogsCenter; +import seedu.address.commons.core.index.Index; import seedu.address.model.person.Person; /** @@ -26,6 +27,9 @@ public class ModelManager implements Model { private final UserPrefs userPrefs; private final FilteredList filteredPersons; + private Index lastViewedPersonIndex; + + /** * Initializes a ModelManager with the given addressBook and userPrefs. */ @@ -151,6 +155,19 @@ public void updateFilteredPersonList(Predicate predicate1, Predicate predicate1.test(person) && predicate2.test(person)); } + @Override + public void setLastViewedPersonIndex(Index index) { + requireNonNull(index); + lastViewedPersonIndex = index; + } + + @Override + public Index getLastViewedPersonIndex() { + return lastViewedPersonIndex; + } + + + @Override public boolean equals(Object other) { if (other == this) { diff --git a/src/main/java/seedu/address/ui/MainWindow.java b/src/main/java/seedu/address/ui/MainWindow.java index 79e74ef37c0..bc947dbc910 100644 --- a/src/main/java/seedu/address/ui/MainWindow.java +++ b/src/main/java/seedu/address/ui/MainWindow.java @@ -12,10 +12,12 @@ import javafx.stage.Stage; import seedu.address.commons.core.GuiSettings; import seedu.address.commons.core.LogsCenter; +import seedu.address.commons.core.index.Index; import seedu.address.logic.Logic; import seedu.address.logic.commands.CommandResult; import seedu.address.logic.commands.exceptions.CommandException; import seedu.address.logic.parser.exceptions.ParseException; +import seedu.address.model.person.Person; /** * The Main Window. Provides the basic application layout containing @@ -35,6 +37,8 @@ public class MainWindow extends UiPart { private ResultDisplay resultDisplay; private HelpWindow helpWindow; + private PersonInformationPanel personInformationPanel; + @FXML private StackPane commandBoxPlaceholder; @@ -47,6 +51,9 @@ public class MainWindow extends UiPart { @FXML private StackPane resultDisplayPlaceholder; + @FXML + private StackPane personInformationPanelPlaceholder; + @FXML private StackPane statusbarPlaceholder; @@ -110,6 +117,7 @@ private void setAccelerator(MenuItem menuItem, KeyCombination keyCombination) { * Fills up all the placeholders of this window. */ void fillInnerParts() { + personListPanel = new PersonListPanel(logic.getFilteredPersonList()); personListPanelPlaceholder.getChildren().add(personListPanel.getRoot()); @@ -163,6 +171,18 @@ private void handleExit() { primaryStage.hide(); } + /** + * Updates the personListPanel based on last View Command entered + */ + @FXML + private void handleView() { + Index index = logic.getLastViewedPersonIndex(); + Person personToView = logic.getFilteredPersonList().get(index.getZeroBased()); + + personInformationPanel = new PersonInformationPanel(personToView); + personInformationPanelPlaceholder.getChildren().add(personInformationPanel.getRoot()); + } + public PersonListPanel getPersonListPanel() { return personListPanel; } @@ -186,6 +206,10 @@ private CommandResult executeCommand(String commandText) throws CommandException handleExit(); } + if (commandResult.isView()) { + handleView(); + } + return commandResult; } catch (CommandException | ParseException e) { logger.info("An error occurred while executing command: " + commandText); diff --git a/src/main/java/seedu/address/ui/PersonInformationPanel.java b/src/main/java/seedu/address/ui/PersonInformationPanel.java new file mode 100644 index 00000000000..a3a67b358b2 --- /dev/null +++ b/src/main/java/seedu/address/ui/PersonInformationPanel.java @@ -0,0 +1,54 @@ +package seedu.address.ui; + +import java.util.logging.Logger; + +import javafx.fxml.FXML; +import javafx.scene.control.Label; +import javafx.scene.layout.FlowPane; +import javafx.scene.layout.Region; +import seedu.address.commons.core.LogsCenter; +import seedu.address.model.person.Person; + +public class PersonInformationPanel extends UiPart { + + private static final String FXML = "PersonInformationPanel.fxml"; + + private final Logger logger = LogsCenter.getLogger(PersonListPanel.class); + + + public final Person person; + + @javafx.fxml.FXML + private Label remark; + @FXML + private Label name; + @FXML + private Label id; + @FXML + private Label phone; + @FXML + private Label address; + @FXML + private Label email; + @FXML + private FlowPane tags; + + + public PersonInformationPanel(Person person) { + super(FXML); + this.person = person; + name.setText(person.getName().fullName); + phone.setText(person.getPhone().value); + address.setText(person.getAddress().value); + email.setText(person.getEmail().value); + remark.setText(person.getRemark().value); + person.getTags().stream() + .sorted(java.util.Comparator.comparing(tag -> tag.tagName)) + .forEach(tag -> tags.getChildren().add(new Label(tag.tagName))); + + } + + + + +} diff --git a/src/main/resources/view/MainWindow.fxml b/src/main/resources/view/MainWindow.fxml index 7778f666a0a..cfc828f07c1 100644 --- a/src/main/resources/view/MainWindow.fxml +++ b/src/main/resources/view/MainWindow.fxml @@ -11,8 +11,9 @@ + + title="Address App" minWidth="1000" minHeight="800" onCloseRequest="#handleExit"> @@ -46,12 +47,28 @@ - + - - + + + + + + + + + + + + + + + + diff --git a/src/main/resources/view/PersonInformationPanel.fxml b/src/main/resources/view/PersonInformationPanel.fxml new file mode 100644 index 00000000000..57227b4e1a9 --- /dev/null +++ b/src/main/resources/view/PersonInformationPanel.fxml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/java/seedu/address/logic/commands/AddCommandTest.java b/src/test/java/seedu/address/logic/commands/AddCommandTest.java index d2e7b322839..800ba0ae9e4 100644 --- a/src/test/java/seedu/address/logic/commands/AddCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/AddCommandTest.java @@ -17,6 +17,7 @@ import javafx.collections.ObservableList; import seedu.address.commons.core.GuiSettings; +import seedu.address.commons.core.index.Index; import seedu.address.logic.Messages; import seedu.address.logic.commands.exceptions.CommandException; import seedu.address.model.AddressBook; @@ -162,12 +163,24 @@ public void updateFilteredPersonList(Predicate predicate) { @Override public void sortPersonList(Comparator comparator) { throw new AssertionError("This method should not be called"); + } @Override public void updateFilteredPersonList(Predicate predicate1, Predicate predicate2) { throw new AssertionError("This method should not be called."); } + + @Override + public Index getLastViewedPersonIndex() { + throw new AssertionError("This method should not be called."); + } + + @Override + public void setLastViewedPersonIndex(Index index) { + throw new AssertionError("This method should not be called."); + } + } /** diff --git a/src/test/java/seedu/address/logic/commands/CommandResultTest.java b/src/test/java/seedu/address/logic/commands/CommandResultTest.java index 7b8c7cd4546..333de5b94bf 100644 --- a/src/test/java/seedu/address/logic/commands/CommandResultTest.java +++ b/src/test/java/seedu/address/logic/commands/CommandResultTest.java @@ -14,7 +14,7 @@ public void equals() { // same values -> returns true assertTrue(commandResult.equals(new CommandResult("feedback"))); - assertTrue(commandResult.equals(new CommandResult("feedback", false, false))); + assertTrue(commandResult.equals(new CommandResult("feedback", false, false, false))); // same object -> returns true assertTrue(commandResult.equals(commandResult)); @@ -29,10 +29,13 @@ public void equals() { assertFalse(commandResult.equals(new CommandResult("different"))); // different showHelp value -> returns false - assertFalse(commandResult.equals(new CommandResult("feedback", true, false))); + assertFalse(commandResult.equals(new CommandResult("feedback", true, false, false))); // different exit value -> returns false - assertFalse(commandResult.equals(new CommandResult("feedback", false, true))); + assertFalse(commandResult.equals(new CommandResult("feedback", false, true, false))); + + // different isView value -> returns false + assertFalse(commandResult.equals(new CommandResult("feedback", false, false, true))); } @Test @@ -46,10 +49,13 @@ public void hashcode() { assertNotEquals(commandResult.hashCode(), new CommandResult("different").hashCode()); // different showHelp value -> returns different hashcode - assertNotEquals(commandResult.hashCode(), new CommandResult("feedback", true, false).hashCode()); + assertNotEquals(commandResult.hashCode(), new CommandResult("feedback", true, false, false).hashCode()); // different exit value -> returns different hashcode - assertNotEquals(commandResult.hashCode(), new CommandResult("feedback", false, true).hashCode()); + assertNotEquals(commandResult.hashCode(), new CommandResult("feedback", false, true, false).hashCode()); + + // different isView value -> returns different hashcode + assertNotEquals(commandResult.hashCode(), new CommandResult("feedback", false, false, true).hashCode()); } @Test @@ -57,7 +63,7 @@ public void toStringMethod() { CommandResult commandResult = new CommandResult("feedback"); String expected = CommandResult.class.getCanonicalName() + "{feedbackToUser=" + commandResult.getFeedbackToUser() + ", showHelp=" + commandResult.isShowHelp() - + ", exit=" + commandResult.isExit() + "}"; + + ", exit=" + commandResult.isExit() + ", isView=" + commandResult.isView() + "}"; assertEquals(expected, commandResult.toString()); } } diff --git a/src/test/java/seedu/address/logic/commands/ExitCommandTest.java b/src/test/java/seedu/address/logic/commands/ExitCommandTest.java index 9533c473875..a573f42f11b 100644 --- a/src/test/java/seedu/address/logic/commands/ExitCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/ExitCommandTest.java @@ -14,7 +14,7 @@ public class ExitCommandTest { @Test public void execute_exit_success() { - CommandResult expectedCommandResult = new CommandResult(MESSAGE_EXIT_ACKNOWLEDGEMENT, false, true); + CommandResult expectedCommandResult = new CommandResult(MESSAGE_EXIT_ACKNOWLEDGEMENT, false, true, false); assertCommandSuccess(new ExitCommand(), model, expectedCommandResult, expectedModel); } } diff --git a/src/test/java/seedu/address/logic/commands/HelpCommandTest.java b/src/test/java/seedu/address/logic/commands/HelpCommandTest.java index 4904fc4352e..3b35c387c4c 100644 --- a/src/test/java/seedu/address/logic/commands/HelpCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/HelpCommandTest.java @@ -14,7 +14,7 @@ public class HelpCommandTest { @Test public void execute_help_success() { - CommandResult expectedCommandResult = new CommandResult(SHOWING_HELP_MESSAGE, true, false); + CommandResult expectedCommandResult = new CommandResult(SHOWING_HELP_MESSAGE, true, false, false); assertCommandSuccess(new HelpCommand(), model, expectedCommandResult, expectedModel); } } diff --git a/src/test/java/seedu/address/logic/parser/FindCommandParserTest.java b/src/test/java/seedu/address/logic/parser/FindCommandParserTest.java index 34605f205ab..acd0f8c73f3 100644 --- a/src/test/java/seedu/address/logic/parser/FindCommandParserTest.java +++ b/src/test/java/seedu/address/logic/parser/FindCommandParserTest.java @@ -27,10 +27,10 @@ public void parse_validArgs_returnsFindCommand() { FindCommand expectedFindCommand = new FindCommand(new NameContainsKeywordsPredicate(Arrays.asList("Alice", "Bob")), new StatusContainsKeywordsPredicate(Arrays.asList("Interviewed"))); - assertParseSuccess(parser, " n/Alice Bob s/Interviewed", expectedFindCommand); + assertParseSuccess(parser, " n/Alice Bob st/Interviewed", expectedFindCommand); // multiple whitespaces between keywords - assertParseSuccess(parser, " n/ \n Alice \n \t Bob \t s/Interviewed", expectedFindCommand); + assertParseSuccess(parser, " n/ \n Alice \n \t Bob \t st/Interviewed", expectedFindCommand); } @Test