From 0e18c77c6f221b36a953d85751ed20540233c9bd Mon Sep 17 00:00:00 2001 From: katarinaavucic Date: Sun, 6 Aug 2023 02:44:52 -0400 Subject: [PATCH] Uncommented a test. --- .../ExpenseUCITest.java | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/test/java/use_cases/add_edit_expenses_use_case/ExpenseUCITest.java b/src/test/java/use_cases/add_edit_expenses_use_case/ExpenseUCITest.java index 50720c0..0a776b0 100644 --- a/src/test/java/use_cases/add_edit_expenses_use_case/ExpenseUCITest.java +++ b/src/test/java/use_cases/add_edit_expenses_use_case/ExpenseUCITest.java @@ -217,24 +217,24 @@ void editExpenseInMonthNegValueFail() throws EntityException { Assertions.assertThrows(NoSuchElementException.class, () -> interactor.findExpense(session.getMonthlyData(9).getExpenseData(), "Banana")); } -// /** -// * Tests fail edit case when user tries to edit an Expense that does not exist in MonthlyStorage. -// */ -// @Test -// void editExpenseInMonthNoExpenseFail() throws EntityException { -// SessionStorage session = new SessionStorage(); -// ExpenseP presenter = new ExpenseP(); -// ExpenseUCI interactor = new ExpenseUCI(presenter); -// MonthlyStorage monthEdit = new MonthlyStorage(10, 150); -// session.addMonth(monthEdit); -// monthEdit.addCategory(food); -// -// ExpenseID editIdNegValue = new ExpenseID("Banana", -3, "Food", false,10, session, "Sandwich"); -// // Check if the correct message is returned corresponding to the situation. -// assertEquals("There is no such expense in the current month. Please add a new expense or select existing expense!", interactor.editExpenseInMonth(editIdNegValue).getMessage()); -// //Fail to edit Expense name, but the old_expense is not found in MonthlyStorage. -// Assertions.assertThrows(NoSuchElementException.class, () -> interactor.findExpense(session.getMonthlyData(10).getExpenseData(), "Banana")); -// } + /** + * Tests fail edit case when user tries to edit an Expense that does not exist in MonthlyStorage. + */ + @Test + void editExpenseInMonthNoExpenseFail() throws EntityException { + SessionStorage session = new SessionStorage(); + ExpenseP presenter = new ExpenseP(); + ExpenseUCI interactor = new ExpenseUCI(presenter); + MonthlyStorage monthEdit = new MonthlyStorage(10, 150); + session.addMonth(monthEdit); + monthEdit.addCategory(food); + + ExpenseID editIdNegValue = new ExpenseID("Banana", -3, "Food", false,10, session, "Sandwich"); + // Check if the correct message is returned corresponding to the situation. + assertEquals("There is no such expense in the current month. Please add a new expense or select existing expense!", interactor.editExpenseInMonth(editIdNegValue).getMessage()); + //Fail to edit Expense name, but the old_expense is not found in MonthlyStorage. + Assertions.assertThrows(NoSuchElementException.class, () -> interactor.findExpense(session.getMonthlyData(10).getExpenseData(), "Banana")); + } /** * Tests fail edit case when user tries to edit the Expense budget into an invalid double.