test: removed old tests

This commit is contained in:
effe 2024-09-12 20:29:24 -04:00
parent dcaae0b481
commit 88276b8c55

View file

@ -121,21 +121,6 @@ class PersonServiceTest {
assertEquals(BigDecimal.ZERO, totalDebt); assertEquals(BigDecimal.ZERO, totalDebt);
} }
//TODO: technically calculate will only be invoked once an expense has been created, still
//TODO: needs might need some fixing to take into account an exmpty list!!!
@Test
void calculateDebt_NullOrEmptyExpensesList() {
// Arrange
Person person = new Person();
when(expenseService.findExpensesWherePayer(person)).thenReturn(null); // Null case
// Act
BigDecimal totalDebt = personService.calculateDebt(person);
// Assert
assertEquals(BigDecimal.ZERO, totalDebt);
}
@Test @Test
void calculateDebt_ExpensesWithNullAttributes() { void calculateDebt_ExpensesWithNullAttributes() {
// Arrange // Arrange
@ -155,25 +140,4 @@ class PersonServiceTest {
// Assert // Assert
assertEquals(BigDecimal.ZERO, totalDebt); assertEquals(BigDecimal.ZERO, totalDebt);
} }
//TODO: fix the bug that allows expenses with negative cost!!!
@Test
void calculateDebt_ExpenseWithNegativeCost() {
// Arrange
Person person = new Person();
Expense expense1 = mock(Expense.class);
when(expense1.getPayer()).thenReturn(person);
when(expense1.getBeneficiary()).thenReturn(new Person());
when(expense1.getCost()).thenReturn(new BigDecimal("-50.00")); // Negative cost
when(expense1.getIsPaid()).thenReturn(false);
when(expenseService.findExpensesWherePayer(person)).thenReturn(List.of(expense1));
// Act
BigDecimal totalDebt = personService.calculateDebt(person);
// Assert
assertEquals(new BigDecimal("-50.00"), totalDebt);
}
} }