From 863c81bde0e02693c403ecee2e0db0e7aa2dc0bb Mon Sep 17 00:00:00 2001 From: Karok365 Date: Fri, 25 Oct 2024 12:53:26 +0530 Subject: [PATCH] implemented the function in ShoppingListServiceTestUtil and ProductServiceTestUtil --- .../depensaapp/app/products/ProductServiceTestUtil.java | 7 ++----- .../app/shoppinglist/ShoppingListServiceTestUtil.java | 6 ++---- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/test/java/dev/nmarulo/depensaapp/app/products/ProductServiceTestUtil.java b/src/test/java/dev/nmarulo/depensaapp/app/products/ProductServiceTestUtil.java index 359f2e8..21c5e77 100644 --- a/src/test/java/dev/nmarulo/depensaapp/app/products/ProductServiceTestUtil.java +++ b/src/test/java/dev/nmarulo/depensaapp/app/products/ProductServiceTestUtil.java @@ -7,9 +7,6 @@ import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.PageRequest; - -import java.math.BigDecimal; -import java.time.LocalDateTime; import java.util.Collections; @Getter @@ -69,9 +66,9 @@ private static Product initProduct() { product.setId(FakeTestUtil.randomLong()); product.setName(FakeTestUtil.randomWord()); - product.setPrice(BigDecimal.ZERO); + product.setPrice(FakeTestUtil.randomBigDecimal()); product.setImgUrl(FakeTestUtil.randomImage()); - product.setCalories(BigDecimal.ZERO); + product.setCalories(FakeTestUtil.randomBigDecimal()); product.setDescription(FakeTestUtil.randomSentence()); product.setCreatedAt(FakeTestUtil.randomPast()); product.setUpdatedAt(FakeTestUtil.randomFuture()); diff --git a/src/test/java/dev/nmarulo/depensaapp/app/shoppinglist/ShoppingListServiceTestUtil.java b/src/test/java/dev/nmarulo/depensaapp/app/shoppinglist/ShoppingListServiceTestUtil.java index 42fb2dd..dffdf0e 100644 --- a/src/test/java/dev/nmarulo/depensaapp/app/shoppinglist/ShoppingListServiceTestUtil.java +++ b/src/test/java/dev/nmarulo/depensaapp/app/shoppinglist/ShoppingListServiceTestUtil.java @@ -8,8 +8,6 @@ import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.PageRequest; -import java.math.BigDecimal; -import java.time.LocalDateTime; import java.util.Collections; @Getter @@ -48,8 +46,8 @@ private ShoppingList initShoppingList(User user) { shoppingList.setId(FakeTestUtil.randomInteger()); shoppingList.setName(FakeTestUtil.randomSentence()); shoppingList.setTotalProducts(0); - shoppingList.setTotalCalories(BigDecimal.ZERO); - shoppingList.setTotalPrice(BigDecimal.ZERO); + shoppingList.setTotalCalories(FakeTestUtil.randomBigDecimal()); + shoppingList.setTotalPrice(FakeTestUtil.randomBigDecimal()); shoppingList.setCreatedAt(FakeTestUtil.randomPast()); shoppingList.setUpdatedAt(FakeTestUtil.randomFuture()); shoppingList.setProductHasShoppingList(Collections.emptySet());