diff --git a/src/main/java/seedu/address/logic/commands/CommandResult.java b/src/main/java/seedu/address/logic/commands/CommandResult.java index 82fafa3d240..98f46265fdd 100644 --- a/src/main/java/seedu/address/logic/commands/CommandResult.java +++ b/src/main/java/seedu/address/logic/commands/CommandResult.java @@ -11,13 +11,19 @@ public class CommandResult { private final String feedbackToUser; - /** Light mode should be shown to the user. */ + /** + * Light mode should be shown to the user. + */ private final boolean showLight; - /** Dark mode should be shown to the user. */ + /** + * Dark mode should be shown to the user. + */ private final boolean showDark; - /** Help information should be shown to the user. */ + /** + * Help information should be shown to the user. + */ private final boolean showHelp; /** @@ -92,10 +98,11 @@ public boolean equals(Object other) { CommandResult otherCommandResult = (CommandResult) other; return feedbackToUser.equals(otherCommandResult.feedbackToUser) - && showHelp == otherCommandResult.showHelp - && exit == otherCommandResult.exit - && showLight == otherCommandResult.showLight - && showDark == otherCommandResult.showDark; + && showHelp == otherCommandResult.showHelp + && exit == otherCommandResult.exit + && showLight == otherCommandResult.showLight + && showDark == otherCommandResult.showDark + && showBackups == otherCommandResult.showBackups; } @Override diff --git a/src/main/java/seedu/address/ui/MainWindow.java b/src/main/java/seedu/address/ui/MainWindow.java index 7743003a87a..bcd1f2dda69 100644 --- a/src/main/java/seedu/address/ui/MainWindow.java +++ b/src/main/java/seedu/address/ui/MainWindow.java @@ -20,7 +20,6 @@ import seedu.address.logic.commands.CommandResult; import seedu.address.logic.commands.ViewCommand; import seedu.address.logic.commands.exceptions.CommandException; -import seedu.address.logic.parser.exceptions.ParseException; import seedu.address.ui.theme.Theme; import seedu.address.ui.theme.ThemeException; @@ -183,7 +182,7 @@ void show() { @FXML private void handleExit() { GuiSettings guiSettings = new GuiSettings(primaryStage.getWidth(), primaryStage.getHeight(), - (int) primaryStage.getX(), (int) primaryStage.getY(), theme.toString()); + (int) primaryStage.getX(), (int) primaryStage.getY(), theme.toString()); logic.setGuiSettings(guiSettings); helpWindow.hide(); primaryStage.hide(); @@ -194,8 +193,7 @@ private void handleExit() { * * @see seedu.address.logic.Logic#execute(String) */ - private CommandResult executeCommand(String commandText) throws CommandException, - ParseException, IllegalValueException { + private CommandResult executeCommand(String commandText) throws CommandException, IllegalValueException { try { CommandResult commandResult = logic.execute(commandText); logger.info("Result: " + commandResult.getFeedbackToUser()); @@ -214,7 +212,7 @@ private CommandResult executeCommand(String commandText) throws CommandException isShowBackup = true; } - if (isShowBackup) { + if (!commandResult.isShowBackups()) { newFillInnerParts(); isShowBackup = false; } @@ -228,7 +226,7 @@ private CommandResult executeCommand(String commandText) throws CommandException } return commandResult; - } catch (CommandException | ParseException e) { + } catch (CommandException e) { logger.info("Invalid command: " + commandText); resultDisplay.setFeedbackToUser(e.getMessage()); throw e; diff --git a/src/test/java/seedu/address/logic/commands/ViewBackupsCommandTest.java b/src/test/java/seedu/address/logic/commands/ViewBackupsCommandTest.java index a024b6dc259..c8b096add79 100644 --- a/src/test/java/seedu/address/logic/commands/ViewBackupsCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/ViewBackupsCommandTest.java @@ -26,7 +26,7 @@ public void setUp() { @Test public void execute_success() { - assertCommandSuccess(new ViewBackupsCommand(), model, ViewBackupsCommand.MESSAGE_SUCCESS, - expectedModel); + ViewBackupsCommand toTest = new ViewBackupsCommand(); + assertCommandSuccess(toTest, model, toTest.execute(model), expectedModel); } }