Skip to content

Commit

Permalink
Uncommented a test.
Browse files Browse the repository at this point in the history
  • Loading branch information
katarinaavucic committed Aug 6, 2023
1 parent 77d588d commit 0e18c77
Showing 1 changed file with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 0e18c77

Please sign in to comment.