From 85dc084d274b87c2223c4de7654a2a4cd08c5adf Mon Sep 17 00:00:00 2001 From: Cazh1 Date: Sun, 12 Nov 2023 13:25:05 +0800 Subject: [PATCH] Update Code quality --- src/main/java/seedu/cafectrl/storage/Storage.java | 2 +- src/main/java/seedu/cafectrl/ui/Messages.java | 5 ++--- src/main/java/seedu/cafectrl/ui/Ui.java | 2 +- .../seedu/cafectrl/command/ViewTotalStockCommandTest.java | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/seedu/cafectrl/storage/Storage.java b/src/main/java/seedu/cafectrl/storage/Storage.java index 0bb03191c1..bed833ebba 100644 --- a/src/main/java/seedu/cafectrl/storage/Storage.java +++ b/src/main/java/seedu/cafectrl/storage/Storage.java @@ -82,7 +82,7 @@ public void detectTamper() { isTamperedMessagePrinted = true; } if (isHashStringTampered) { - ui.showToUser(Messages.HASH_STRING_TAMPERED); + ui.showToUser(Messages.HASH_STRING_TAMPERED, Messages.HASH_STRING_MESSAGE, ""); isHashStringTampered = false; } if (isMenuTampered) { diff --git a/src/main/java/seedu/cafectrl/ui/Messages.java b/src/main/java/seedu/cafectrl/ui/Messages.java index fa7fcbdb9e..508431a54b 100644 --- a/src/main/java/seedu/cafectrl/ui/Messages.java +++ b/src/main/java/seedu/cafectrl/ui/Messages.java @@ -24,9 +24,7 @@ public class Messages { /** Messages for view stock command */ public static final String EMPTY_STOCK = "Sorry! Pantry is currently empty!"; - - public static final String VIEW_STOCK_MESSAGE = "You have the following ingredients in pantry:"; - public static final String VIEW_STOCK_MESSAGE2 = "| You have the following ingredients in pantry: |"; + public static final String VIEW_STOCK_MESSAGE = "| You have the following ingredients in pantry: |"; public static final String VIEW_STOCK_TITLE_MESSAGE = "| Ingredients | Qty |"; /** Messages for help command */ @@ -100,5 +98,6 @@ public class Messages { public static final String HASH_STRING_TAMPERED = "Alert! It appears the hash string " + "got a makeover without permission."; + public static final String HASH_STRING_MESSAGE = "Please resist the temptation to play Picasso with this string."; } diff --git a/src/main/java/seedu/cafectrl/ui/Ui.java b/src/main/java/seedu/cafectrl/ui/Ui.java index ab14a5ee19..b9625784af 100644 --- a/src/main/java/seedu/cafectrl/ui/Ui.java +++ b/src/main/java/seedu/cafectrl/ui/Ui.java @@ -205,7 +205,7 @@ public void showMenuDish(String indexNum, String dishName, String dishPrice) { } public void showIngredientTop() { - showToUser(Messages.MENU_END_CAP, Messages.VIEW_STOCK_MESSAGE2, + showToUser(Messages.MENU_END_CAP, Messages.VIEW_STOCK_MESSAGE, Messages.MENU_CORNER, Messages.VIEW_STOCK_TITLE_MESSAGE, Messages.MENU_CORNER); } diff --git a/src/test/java/seedu/cafectrl/command/ViewTotalStockCommandTest.java b/src/test/java/seedu/cafectrl/command/ViewTotalStockCommandTest.java index 788fcbf27c..5992b75912 100644 --- a/src/test/java/seedu/cafectrl/command/ViewTotalStockCommandTest.java +++ b/src/test/java/seedu/cafectrl/command/ViewTotalStockCommandTest.java @@ -34,7 +34,7 @@ void execute_printPantryStock() { System.setOut(originalOut); String expectedOutput = Messages.MENU_END_CAP - + Messages.VIEW_STOCK_MESSAGE2 + + Messages.VIEW_STOCK_MESSAGE + Messages.MENU_CORNER + Messages.VIEW_STOCK_TITLE_MESSAGE + Messages.MENU_CORNER