From bf5ab8e5537d67fd8309dc95b3ed7403b6ee2187 Mon Sep 17 00:00:00 2001 From: koreanMike513 Date: Tue, 24 Dec 2024 13:29:54 +0000 Subject: [PATCH] fix: Fixed calculateCost() method in Food entity - applied multiply() method instead type manual castings --- src/main/java/com/f_lab/la_planete/domain/Food.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/f_lab/la_planete/domain/Food.java b/src/main/java/com/f_lab/la_planete/domain/Food.java index b308666..7825b7b 100644 --- a/src/main/java/com/f_lab/la_planete/domain/Food.java +++ b/src/main/java/com/f_lab/la_planete/domain/Food.java @@ -47,7 +47,7 @@ public static Food of(BigDecimal price, int totalQuantity) { } public BigDecimal calculateCost(int quantity) { - return BigDecimal.valueOf((long) price.intValue() * quantity); + return price.multiply(BigDecimal.valueOf(quantity)); } public void minusQuantity(int deductions) {