From 13d5f1bf29873db23d7ba49511ab0928c0b62ab3 Mon Sep 17 00:00:00 2001 From: filippo-ferrari Date: Sat, 7 Sep 2024 21:55:00 +0200 Subject: [PATCH] fix: changed wrong conditions --- .../java/com/application/munera/services/ExpenseService.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/application/munera/services/ExpenseService.java b/src/main/java/com/application/munera/services/ExpenseService.java index 629230f..53d8afa 100644 --- a/src/main/java/com/application/munera/services/ExpenseService.java +++ b/src/main/java/com/application/munera/services/ExpenseService.java @@ -13,7 +13,6 @@ import javax.annotation.Nonnull; import java.time.LocalDateTime; import java.util.Collection; import java.util.List; -import java.util.Objects; import java.util.Optional; import java.util.stream.Stream; @@ -141,10 +140,10 @@ public class ExpenseService { * @param expense the expense to set the type of */ private void setExpenseType(final @Nonnull Expense expense) { - if (Objects.nonNull(expense.getCreditors()) && !expense.getCreditors().isEmpty()) + if (!expense.getCreditors().isEmpty()) // If creditors are present, set type to CREDIT expense.setExpenseType(ExpenseType.CREDIT); - else if (Objects.nonNull(expense.getDebtors()) && !expense.getDebtors().isEmpty()) + else if (!expense.getDebtors().isEmpty()) // If debtors are present and no creditors, set type to DEBIT expense.setExpenseType(ExpenseType.DEBIT); else