From 17e26f05f8a6bac19f99c096f745b75960d1308f Mon Sep 17 00:00:00 2001 From: DinhThaiVV Date: Wed, 30 Oct 2024 10:34:18 +0700 Subject: [PATCH] issue #1168: update IT test --- .../java/com/yas/product/controller/ProductControllerIT.java | 4 ++-- .../src/it/java/com/yas/product/service/ProductServiceIT.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/product/src/it/java/com/yas/product/controller/ProductControllerIT.java b/product/src/it/java/com/yas/product/controller/ProductControllerIT.java index 70c96f2428..386b4a3871 100644 --- a/product/src/it/java/com/yas/product/controller/ProductControllerIT.java +++ b/product/src/it/java/com/yas/product/controller/ProductControllerIT.java @@ -215,13 +215,13 @@ void test_getProductListBackoffice_shouldReturnProductList() { } @Test - void test_getProductFeature_shouldReturnProductList() { + void test_getProductFeature_shouldReturnEmptyList() { getGivenSpecificationWithAdmin() .when() .get(PRODUCT_STOREFRONT_URL + "/featured") .then() .statusCode(HttpStatus.OK.value()) - .body("productList", hasSize(2)) + .body("productList", hasSize(0)) .log().ifValidationFails(); } diff --git a/product/src/it/java/com/yas/product/service/ProductServiceIT.java b/product/src/it/java/com/yas/product/service/ProductServiceIT.java index 0894aab9de..8b7c480fc2 100644 --- a/product/src/it/java/com/yas/product/service/ProductServiceIT.java +++ b/product/src/it/java/com/yas/product/service/ProductServiceIT.java @@ -87,10 +87,10 @@ class ProductServiceIT { @BeforeEach void setUp() { + generateTestData(); noFileMediaVm = new NoFileMediaVm(1L, "caption", "fileName", "mediaType", "url"); when(mediaService.getMedia(1L)).thenReturn(noFileMediaVm); - when(inventoryService.getProductIdsAddedWarehouse()).thenReturn(new ArrayList<>()); - generateTestData(); + when(inventoryService.getProductIdsAddedWarehouse()).thenReturn(products.stream().map(p->p.getId()).toList()); } private void generateTestData() {