From 3e27534f96f8ad4eb46b5355cd86f21041abf28b Mon Sep 17 00:00:00 2001 From: Tan Wen Xuan <> Date: Sat, 2 Nov 2024 00:59:25 +0800 Subject: [PATCH] Fix code mistakes --- .../seedu/address/logic/LogicManagerTest.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/test/java/seedu/address/logic/LogicManagerTest.java b/src/test/java/seedu/address/logic/LogicManagerTest.java index fed5462b762..aaccf9a3c80 100644 --- a/src/test/java/seedu/address/logic/LogicManagerTest.java +++ b/src/test/java/seedu/address/logic/LogicManagerTest.java @@ -137,7 +137,6 @@ public void execute_listCommandWhenNoClients_throwsCommandException() { assertCommandException(listCommand, ListCommand.MESSAGE_NO_CLIENT_IN_LIST); } - /* @Test public void execute_storageThrowsIoException_throwsCommandException() { assertCommandFailureForExceptionFromStorage(DUMMY_IO_EXCEPTION, String.format( @@ -149,7 +148,6 @@ public void execute_storageThrowsAdException_throwsCommandException() { assertCommandFailureForExceptionFromStorage(DUMMY_AD_EXCEPTION, String.format( LogicManager.FILE_OPS_PERMISSION_ERROR_FORMAT, DUMMY_AD_EXCEPTION.getMessage())); } - */ @Test public void getFilteredPersonList_modifyList_throwsUnsupportedOperationException() { assertThrows(UnsupportedOperationException.class, () -> logic.getFilteredPersonList().remove(0)); @@ -233,15 +231,12 @@ public void saveAddressBook(ReadOnlyAddressBook addressBook, Path filePath) thro logic = new LogicManager(model, storage); - // Trigger the saveAddressBook method by executing an add command + // Trigger the saveAddressBook method by executing an add buyer command String addBuyerCommand = AddBuyerProfile.COMMAND_WORD + " " + NAME_DESC_AMY + " " + PHONE_DESC_AMY + " " + EMAIL_DESC_AMY; - - String addSellerCommand = AddSellerProfile.COMMAND_WORD + " " + NAME_DESC_AMY + " " - + PHONE_DESC_AMY + " " + EMAIL_DESC_AMY; - - // Use a loop or separate assertions if needed - assertCommandFailure(addBuyerCommand, CommandException.class, expectedMessage); - assertCommandFailure(addSellerCommand, CommandException.class, expectedMessage); + Buyer expectedBuyer = new PersonBuilder(AMY).withTags().buildBuyer(); + ModelManager expectedModel = new ModelManager(); + expectedModel.addPerson(expectedBuyer); + assertCommandFailure(addBuyerCommand, CommandException.class, expectedMessage, expectedModel); } }