From 2328b995cdad06fbbd810fbb33bb57c1c513da27 Mon Sep 17 00:00:00 2001 From: ignatIgnatov Date: Wed, 15 May 2024 10:41:41 +0300 Subject: [PATCH] some changes after code review --- .../OrganizationSaleController.java | 12 +- .../mapper/ProductInOrganizationMapper.java | 3 +- .../inventory/service/SaleService.java | 12 +- .../helper/OrganizationTestHelper.java | 2 + .../inventory/helper/SaleTestHelper.java | 119 +++++++++++------- .../integration/SaleCrudIntegrationTest.java | 63 ++++------ .../service/OrganizationSaleServiceTest.java | 13 +- .../unit/service/SaleServiceTest.java | 6 +- 8 files changed, 120 insertions(+), 110 deletions(-) diff --git a/src/main/java/jewellery/inventory/controller/OrganizationSaleController.java b/src/main/java/jewellery/inventory/controller/OrganizationSaleController.java index 6387a574..3df9e16d 100644 --- a/src/main/java/jewellery/inventory/controller/OrganizationSaleController.java +++ b/src/main/java/jewellery/inventory/controller/OrganizationSaleController.java @@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.*; @RestController -@RequestMapping("/organizations") +@RequestMapping("/organizations/sales") @RequiredArgsConstructor public class OrganizationSaleController { @@ -22,21 +22,21 @@ public class OrganizationSaleController { @Operation(summary = "Create sale from organization to user") @ResponseStatus(HttpStatus.CREATED) - @PostMapping("/sales") + @PostMapping public OrganizationSaleResponseDto createSale(@Valid @RequestBody SaleRequestDto saleRequestDto) { return organizationSaleService.createSale(saleRequestDto); } @Operation(summary = "Return of a sold product from user to organization") @ResponseStatus(HttpStatus.OK) - @PutMapping("/sales/return-product/{productId}") + @PutMapping("/return-product/{productId}") public ProductReturnResponseDto returnProduct(@PathVariable("productId") UUID productId) { return organizationSaleService.returnProduct(productId); } @Operation(summary = "Return of a sold resource from user to organization") @ResponseStatus(HttpStatus.OK) - @PutMapping("/sales/{saleId}/return-resource/{resourceId}") + @PutMapping("/{saleId}/return-resource/{resourceId}") public ResourceReturnResponseDto returnResource( @PathVariable("saleId") UUID saleId, @PathVariable("resourceId") UUID resourceId) { return organizationSaleService.returnResource(saleId, resourceId); @@ -44,14 +44,14 @@ public ResourceReturnResponseDto returnResource( @Operation(summary = "Get all sales from organization to user") @ResponseStatus(HttpStatus.OK) - @GetMapping("/sales") + @GetMapping public List getAllSales() { return organizationSaleService.getAllSales(); } @Operation(summary = "Get sale from organization to user") @ResponseStatus(HttpStatus.OK) - @GetMapping("/sales/{saleId}") + @GetMapping("/{saleId}") public OrganizationSaleResponseDto getSale(@PathVariable("saleId") UUID saleId) { return organizationSaleService.getSale(saleId); } diff --git a/src/main/java/jewellery/inventory/mapper/ProductInOrganizationMapper.java b/src/main/java/jewellery/inventory/mapper/ProductInOrganizationMapper.java index 4cbe6c45..de8e502f 100644 --- a/src/main/java/jewellery/inventory/mapper/ProductInOrganizationMapper.java +++ b/src/main/java/jewellery/inventory/mapper/ProductInOrganizationMapper.java @@ -1,12 +1,13 @@ package jewellery.inventory.mapper; -import java.util.List; import jewellery.inventory.dto.response.ProductResponseDto; import jewellery.inventory.dto.response.ProductsInOrganizationResponseDto; import jewellery.inventory.model.Organization; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; +import java.util.List; + @Component @RequiredArgsConstructor public class ProductInOrganizationMapper { diff --git a/src/main/java/jewellery/inventory/service/SaleService.java b/src/main/java/jewellery/inventory/service/SaleService.java index 7fdf26c0..631c9368 100644 --- a/src/main/java/jewellery/inventory/service/SaleService.java +++ b/src/main/java/jewellery/inventory/service/SaleService.java @@ -258,17 +258,15 @@ public List getResourcesFromSaleRequestDto( SaleRequestDto saleRequestDto) { if (saleRequestDto.getResources() != null) { List resources = new ArrayList<>(); - if (saleRequestDto.getResources() != null) { - for (PurchasedResourceQuantityRequestDto resourceRequest : saleRequestDto.getResources()) { - PurchasedResourceInUser purchasedResourceInUser = - getPurchasedResourceInUser(resourceRequest); - resources.add(purchasedResourceInUser); - } + for (PurchasedResourceQuantityRequestDto resourceRequest : saleRequestDto.getResources()) { + PurchasedResourceInUser purchasedResourceInUser = + getPurchasedResourceInUser(resourceRequest); + resources.add(purchasedResourceInUser); } return resources; } - return null; + return new ArrayList<>(); } private PurchasedResourceInUser getPurchasedResourceInUser( diff --git a/src/test/java/jewellery/inventory/helper/OrganizationTestHelper.java b/src/test/java/jewellery/inventory/helper/OrganizationTestHelper.java index df44a9c8..47baeec9 100644 --- a/src/test/java/jewellery/inventory/helper/OrganizationTestHelper.java +++ b/src/test/java/jewellery/inventory/helper/OrganizationTestHelper.java @@ -3,11 +3,13 @@ import java.math.BigDecimal; import java.util.*; +import io.micrometer.common.lang.Nullable; import jewellery.inventory.dto.request.OrganizationRequestDto; import jewellery.inventory.dto.request.UserInOrganizationRequestDto; import jewellery.inventory.dto.response.*; import jewellery.inventory.model.*; import jewellery.inventory.model.resource.Resource; +import org.springframework.http.ResponseEntity; public class OrganizationTestHelper { private static final String ORGANIZATION_NAME = "Test Name"; diff --git a/src/test/java/jewellery/inventory/helper/SaleTestHelper.java b/src/test/java/jewellery/inventory/helper/SaleTestHelper.java index 03bb1a0f..2b62c912 100644 --- a/src/test/java/jewellery/inventory/helper/SaleTestHelper.java +++ b/src/test/java/jewellery/inventory/helper/SaleTestHelper.java @@ -75,7 +75,8 @@ public static ProductDiscountRequestDto createProductPriceDiscountRequest( return productRequest; } - public static SaleResponseDto getSaleResponseDto(Sale sale) { + public static SaleResponseDto getSaleResponseDto( + Sale sale, BigDecimal salePrice, BigDecimal discount) { SaleResponseDto dto = new SaleResponseDto(); UserResponseDto userResponseDtoSeller = createUserResponseDto(sale.getSeller()); UserResponseDto userResponseDtoBuyer = createUserResponseDto(sale.getBuyer()); @@ -87,8 +88,8 @@ public static SaleResponseDto getSaleResponseDto(Sale sale) { dto.setTotalDiscount(BigDecimal.ZERO); dto.setProducts(List.of(productResponseDto)); - calculateProductsDiscounts(sale, dto); - calculateResourcesDiscounts(sale, dto); + calculateProductsDiscounts(sale, dto, salePrice, discount); + calculateResourcesDiscounts(sale, dto, salePrice, discount); dto.setProducts(createProductsResponse(sale, dto)); dto.setResources(createResourcesResponse(sale)); @@ -96,7 +97,8 @@ public static SaleResponseDto getSaleResponseDto(Sale sale) { return dto; } - public static OrganizationSaleResponseDto getOrganizationSaleResponseDto(Sale sale) { + public static OrganizationSaleResponseDto getOrganizationSaleResponseDto( + Sale sale, BigDecimal salePrice, BigDecimal discount) { OrganizationSaleResponseDto dto = new OrganizationSaleResponseDto(); OrganizationResponseDto organizationResponseDto = OrganizationTestHelper.getTestOrganizationResponseDto( @@ -110,8 +112,8 @@ public static OrganizationSaleResponseDto getOrganizationSaleResponseDto(Sale sa dto.setTotalDiscount(BigDecimal.ZERO); dto.setProducts(List.of(productResponseDto)); - calculateOrganizationProductsDiscounts(sale, dto); - calculateOrganizationResourcesDiscounts(sale, dto); + calculateOrganizationProductsDiscounts(sale, dto, salePrice, discount); + calculateOrganizationResourcesDiscounts(sale, dto, salePrice, discount); dto.setProducts(createOrganizationProductsResponse(sale, dto)); dto.setResources(createResourcesResponse(sale)); @@ -143,69 +145,63 @@ private static List createResourcesRespons return null; } - private static void calculateResourcesDiscounts(Sale sale, SaleResponseDto dto) { + private static void calculateResourcesDiscounts( + Sale sale, SaleResponseDto dto, BigDecimal price, BigDecimal discount) { sale.getResources() .forEach( resource -> { - BigDecimal salePrice = - Optional.ofNullable(resource.getSalePrice()).orElse(BigDecimal.ZERO); - BigDecimal discount = - Optional.ofNullable(resource.getDiscount()).orElse(BigDecimal.ZERO); + BigDecimal salePrice = Optional.ofNullable(resource.getSalePrice()).orElse(price); + BigDecimal saleDiscount = + Optional.ofNullable(resource.getDiscount()).orElse(discount); dto.setTotalDiscountedPrice(dto.getTotalDiscountedPrice().add(salePrice)); dto.setTotalDiscount( - (dto.getTotalDiscount().add(discount)) + (dto.getTotalDiscount().add(saleDiscount)) .divide(salePrice, MathContext.DECIMAL128) .multiply(getBigDecimal("100"))); }); } private static void calculateOrganizationResourcesDiscounts( - Sale sale, OrganizationSaleResponseDto dto) { - if (sale.getResources() != null) { - sale.getResources() - .forEach( - resource -> { - BigDecimal salePrice = - Optional.ofNullable(resource.getSalePrice()).orElse(BigDecimal.ZERO); - BigDecimal discount = - Optional.ofNullable(resource.getDiscount()).orElse(BigDecimal.ZERO); - dto.setTotalDiscountedPrice(dto.getTotalDiscountedPrice().add(salePrice)); - dto.setTotalDiscount( - (dto.getTotalDiscount().add(discount)) - .divide(salePrice, MathContext.DECIMAL128) - .multiply(getBigDecimal("100"))); - }); - } + Sale sale, OrganizationSaleResponseDto dto, BigDecimal price, BigDecimal discount) { + sale.getResources() + .forEach( + resource -> { + BigDecimal salePrice = Optional.ofNullable(resource.getSalePrice()).orElse(price); + BigDecimal saleDiscount = + Optional.ofNullable(resource.getDiscount()).orElse(discount); + dto.setTotalDiscountedPrice(dto.getTotalDiscountedPrice().add(salePrice)); + dto.setTotalDiscount( + (dto.getTotalDiscount().add(saleDiscount)) + .divide(salePrice, MathContext.DECIMAL128) + .multiply(getBigDecimal("100"))); + }); } - private static void calculateProductsDiscounts(Sale sale, SaleResponseDto dto) { + private static void calculateProductsDiscounts( + Sale sale, SaleResponseDto dto, BigDecimal price, BigDecimal discount) { sale.getProducts() .forEach( product -> { - BigDecimal salePrice = - Optional.ofNullable(product.getSalePrice()).orElse(BigDecimal.ZERO); - BigDecimal discount = - Optional.ofNullable(product.getDiscount()).orElse(BigDecimal.ZERO); + BigDecimal salePrice = Optional.ofNullable(product.getSalePrice()).orElse(price); + BigDecimal saleDiscount = Optional.ofNullable(product.getDiscount()).orElse(discount); dto.setTotalDiscountedPrice(dto.getTotalDiscountedPrice().add(salePrice)); dto.setTotalDiscount( - (dto.getTotalDiscount().add(discount)) + (dto.getTotalDiscount().add(saleDiscount)) .divide(salePrice, MathContext.DECIMAL128) .multiply(getBigDecimal("100"))); }); } private static void calculateOrganizationProductsDiscounts( - Sale sale, OrganizationSaleResponseDto dto) { + Sale sale, OrganizationSaleResponseDto dto, BigDecimal price, BigDecimal discount) { sale.getProducts() .forEach( product -> { - BigDecimal salePrice = - Optional.ofNullable(product.getSalePrice()).orElse(BigDecimal.ZERO); - BigDecimal discount = - Optional.ofNullable(product.getDiscount()).orElse(BigDecimal.ZERO); + BigDecimal salePrice = Optional.ofNullable(product.getSalePrice()).orElse(price); + BigDecimal saleDiscount = Optional.ofNullable(product.getDiscount()).orElse(discount); dto.setTotalDiscountedPrice(dto.getTotalDiscountedPrice().add(salePrice)); dto.setTotalDiscount( - (dto.getTotalDiscount().add(discount)) + (dto.getTotalDiscount().add(saleDiscount)) .divide(salePrice, MathContext.DECIMAL128) .multiply(getBigDecimal("100"))); }); @@ -284,10 +280,10 @@ public static ProductPriceDiscount createTestProductPriceDiscount(Product produc } public static Sale createSaleInOrganization( - Organization seller, - User buyer, - List products, - List resources) { + Organization seller, + User buyer, + List products, + List resources) { Sale sale = new Sale(); sale.setId(UUID.randomUUID()); sale.setOrganizationSeller(seller); @@ -297,4 +293,39 @@ public static Sale createSaleInOrganization( sale.setDate(LocalDate.now()); return sale; } + + public static SaleRequestDto getSaleInOrganizationRequestDto( + Organization seller, + User buyer, + ProductsInOrganizationResponseDto productsInOrganizationResponseDto, + ResourcesInOrganizationResponseDto resourcesInOrganizationResponseDto, + BigDecimal saleDiscount) { + SaleRequestDto saleRequestDto = new SaleRequestDto(); + saleRequestDto.setBuyerId(buyer.getId()); + saleRequestDto.setSellerId(seller.getId()); + saleRequestDto.setDate(LocalDate.now()); + PurchasedResourceQuantityRequestDto purchasedResourceQuantityRequestDto = + new PurchasedResourceQuantityRequestDto(); + ResourceQuantityRequestDto resourceQuantityRequestDto = new ResourceQuantityRequestDto(); + resourceQuantityRequestDto.setResourceId( + resourcesInOrganizationResponseDto + .getResourcesAndQuantities() + .get(0) + .getResource() + .getId()); + resourceQuantityRequestDto.setQuantity(BigDecimal.ONE); + purchasedResourceQuantityRequestDto.setResourceAndQuantity(resourceQuantityRequestDto); + purchasedResourceQuantityRequestDto.setDiscount(saleDiscount); + List resources = new ArrayList<>(); + resources.add(purchasedResourceQuantityRequestDto); + saleRequestDto.setResources(resources); + ProductDiscountRequestDto productDiscountRequestDto = new ProductDiscountRequestDto(); + productDiscountRequestDto.setProductId( + productsInOrganizationResponseDto.getProducts().get(0).getId()); + productDiscountRequestDto.setDiscount(saleDiscount); + List list = new ArrayList<>(); + list.add(productDiscountRequestDto); + saleRequestDto.setProducts(list); + return saleRequestDto; + } } diff --git a/src/test/java/jewellery/inventory/integration/SaleCrudIntegrationTest.java b/src/test/java/jewellery/inventory/integration/SaleCrudIntegrationTest.java index 2cc632d2..d5966d89 100644 --- a/src/test/java/jewellery/inventory/integration/SaleCrudIntegrationTest.java +++ b/src/test/java/jewellery/inventory/integration/SaleCrudIntegrationTest.java @@ -2,6 +2,7 @@ import static jewellery.inventory.helper.OrganizationTestHelper.getTestUserInOrganizationRequest; import static jewellery.inventory.helper.ProductTestHelper.getProductRequestDto; +import static jewellery.inventory.helper.SaleTestHelper.getSaleInOrganizationRequestDto; import static jewellery.inventory.helper.SystemEventTestHelper.*; import static jewellery.inventory.helper.UserTestHelper.*; import static jewellery.inventory.model.EventType.*; @@ -159,11 +160,13 @@ void removeOrganizationSaleAfterReturnAllResourcesAndProductsFromSaleInOrganizat createProductInOrganization(productRequestDto); SaleRequestDto saleRequestDto = getSaleInOrganizationRequestDto( - organizationSeller, buyer, productResponse, resourcesInOrganizationResponseDto); - + organizationSeller, + buyer, + productResponse, + resourcesInOrganizationResponseDto, + SALE_DISCOUNT); ResponseEntity saleResponse = createSaleInOrganization(saleRequestDto); - ResponseEntity resourceReturnResponse = createReturnResourceResponse( saleRequestDto, Objects.requireNonNull(saleResponse.getBody())); @@ -193,8 +196,11 @@ void returnProductFromSaleInOrganizationSuccessfully() throws JsonProcessingExce createProductInOrganization(productRequestDto); SaleRequestDto saleRequestDto = getSaleInOrganizationRequestDto( - organizationSeller, buyer, productResponse, resourcesInOrganizationResponseDto); - + organizationSeller, + buyer, + productResponse, + resourcesInOrganizationResponseDto, + SALE_DISCOUNT); ResponseEntity saleResponse = createSaleInOrganization(saleRequestDto); @@ -226,7 +232,11 @@ void returnResourceFromSaleInOrganizationSuccessfully() throws JsonProcessingExc createProductInOrganization(productRequestDto); SaleRequestDto saleRequestDto = getSaleInOrganizationRequestDto( - organizationSeller, buyer, productResponse, resourcesInOrganizationResponseDto); + organizationSeller, + buyer, + productResponse, + resourcesInOrganizationResponseDto, + SALE_DISCOUNT); ResponseEntity saleResponse = createSaleInOrganization(saleRequestDto); @@ -255,7 +265,11 @@ void createSaleInOrganizationSuccessfully() throws JsonProcessingException { createProductInOrganization(productRequestDto); SaleRequestDto saleRequestDto = getSaleInOrganizationRequestDto( - organizationSeller, buyer, productResponse, resourcesInOrganizationResponseDto); + organizationSeller, + buyer, + productResponse, + resourcesInOrganizationResponseDto, + SALE_DISCOUNT); ResponseEntity saleResponse = createSaleInOrganization(saleRequestDto); @@ -695,41 +709,6 @@ private ResourcesInOrganizationResponseDto createResourceInOrganization( return response.getBody(); } - @NotNull - private static SaleRequestDto getSaleInOrganizationRequestDto( - Organization seller, - User buyer, - ProductsInOrganizationResponseDto productsInOrganizationResponseDto, - ResourcesInOrganizationResponseDto resourcesInOrganizationResponseDto) { - SaleRequestDto saleRequestDto = new SaleRequestDto(); - saleRequestDto.setBuyerId(buyer.getId()); - saleRequestDto.setSellerId(seller.getId()); - saleRequestDto.setDate(LocalDate.now()); - PurchasedResourceQuantityRequestDto purchasedResourceQuantityRequestDto = - new PurchasedResourceQuantityRequestDto(); - ResourceQuantityRequestDto resourceQuantityRequestDto = new ResourceQuantityRequestDto(); - resourceQuantityRequestDto.setResourceId( - resourcesInOrganizationResponseDto - .getResourcesAndQuantities() - .get(0) - .getResource() - .getId()); - resourceQuantityRequestDto.setQuantity(BigDecimal.ONE); - purchasedResourceQuantityRequestDto.setResourceAndQuantity(resourceQuantityRequestDto); - purchasedResourceQuantityRequestDto.setDiscount(SALE_DISCOUNT); - List resources = new ArrayList<>(); - resources.add(purchasedResourceQuantityRequestDto); - saleRequestDto.setResources(resources); - ProductDiscountRequestDto productDiscountRequestDto = new ProductDiscountRequestDto(); - productDiscountRequestDto.setProductId( - productsInOrganizationResponseDto.getProducts().get(0).getId()); - productDiscountRequestDto.setDiscount(SALE_DISCOUNT); - List list = new ArrayList<>(); - list.add(productDiscountRequestDto); - saleRequestDto.setProducts(list); - return saleRequestDto; - } - private ResponseEntity createSaleInOrganization( SaleRequestDto saleRequestDto) { return this.testRestTemplate.postForEntity( diff --git a/src/test/java/jewellery/inventory/unit/service/OrganizationSaleServiceTest.java b/src/test/java/jewellery/inventory/unit/service/OrganizationSaleServiceTest.java index aa1029e6..fee511b1 100644 --- a/src/test/java/jewellery/inventory/unit/service/OrganizationSaleServiceTest.java +++ b/src/test/java/jewellery/inventory/unit/service/OrganizationSaleServiceTest.java @@ -116,7 +116,7 @@ void testCreateSaleOfProductSuccessfully() { .thenReturn(sale); when(saleRepository.save(sale)).thenReturn(sale); OrganizationSaleResponseDto organizationSaleResponseDto = - SaleTestHelper.getOrganizationSaleResponseDto(sale); + SaleTestHelper.getOrganizationSaleResponseDto(sale, BigDecimal.ONE, BigDecimal.TEN); when(saleMapper.mapToOrganizationSaleResponseDto(sale)).thenReturn(organizationSaleResponseDto); OrganizationSaleResponseDto actualSale = organizationSaleService.createSale(saleRequestDto); @@ -136,7 +136,7 @@ void testCreateSaleOfResourceSuccessfully() { when(userService.getUser(buyer.getId())).thenReturn(buyer); when(resourceInOrganizationService.getResourceInOrganization( sale.getOrganizationSeller(), sale.getResources().get(0).getResource())) - .thenReturn(resourceInOrganization); + .thenReturn(resourceInOrganization); saleRequestDto.setProducts(null); when(saleMapper.mapSaleFromOrganization( @@ -144,7 +144,7 @@ void testCreateSaleOfResourceSuccessfully() { .thenReturn(sale); when(saleRepository.save(sale)).thenReturn(sale); OrganizationSaleResponseDto organizationSaleResponseDto = - SaleTestHelper.getOrganizationSaleResponseDto(sale); + SaleTestHelper.getOrganizationSaleResponseDto(sale, BigDecimal.ONE, BigDecimal.TEN); when(saleMapper.mapToOrganizationSaleResponseDto(sale)).thenReturn(organizationSaleResponseDto); OrganizationSaleResponseDto actualSale = organizationSaleService.createSale(saleRequestDto); @@ -165,13 +165,13 @@ void testCreateSaleOfBothProductAndResourceSuccessfully() { when(productService.getProduct(product.getId())).thenReturn(product); when(resourceInOrganizationService.getResourceInOrganization( sale.getOrganizationSeller(), sale.getResources().get(0).getResource())) - .thenReturn(resourceInOrganization); + .thenReturn(resourceInOrganization); when(saleMapper.mapSaleFromOrganization( saleRequestDto, seller, buyer, new ArrayList<>(), new ArrayList<>())) .thenReturn(sale); when(saleRepository.save(sale)).thenReturn(sale); OrganizationSaleResponseDto organizationSaleResponseDto = - SaleTestHelper.getOrganizationSaleResponseDto(sale); + SaleTestHelper.getOrganizationSaleResponseDto(sale, BigDecimal.ONE, BigDecimal.TEN); when(saleMapper.mapToOrganizationSaleResponseDto(sale)).thenReturn(organizationSaleResponseDto); OrganizationSaleResponseDto actualSale = organizationSaleService.createSale(saleRequestDto); @@ -348,8 +348,7 @@ void testReturnResourceSuccessfully() { @Test void testGetSaleShouldThrowWhenSaleNotFound() { - assertThrows(SaleNotFoundException.class, - () -> organizationSaleService.getSale(sale.getId())); + assertThrows(SaleNotFoundException.class, () -> organizationSaleService.getSale(sale.getId())); } @Test diff --git a/src/test/java/jewellery/inventory/unit/service/SaleServiceTest.java b/src/test/java/jewellery/inventory/unit/service/SaleServiceTest.java index 2d4c4e86..4978aeb0 100644 --- a/src/test/java/jewellery/inventory/unit/service/SaleServiceTest.java +++ b/src/test/java/jewellery/inventory/unit/service/SaleServiceTest.java @@ -12,12 +12,12 @@ import java.math.BigDecimal; import java.util.*; import jewellery.inventory.dto.request.ProductDiscountRequestDto; -import jewellery.inventory.dto.request.SaleRequestDto; import jewellery.inventory.dto.request.PurchasedResourceQuantityRequestDto; +import jewellery.inventory.dto.request.SaleRequestDto; import jewellery.inventory.dto.response.ProductReturnResponseDto; -import jewellery.inventory.dto.response.SaleResponseDto; import jewellery.inventory.dto.response.PurchasedResourceQuantityResponseDto; import jewellery.inventory.dto.response.ResourceReturnResponseDto; +import jewellery.inventory.dto.response.SaleResponseDto; import jewellery.inventory.exception.not_found.ResourceNotFoundInSaleException; import jewellery.inventory.exception.not_found.SaleNotFoundException; import jewellery.inventory.exception.product.ProductIsContentException; @@ -102,7 +102,7 @@ void setUp() { buyer.getId(), List.of(productDiscountRequestDto), List.of(purchasedResourceQuantityRequestDto)); - saleResponseDto = SaleTestHelper.getSaleResponseDto(sale); + saleResponseDto = SaleTestHelper.getSaleResponseDto(sale, BigDecimal.ONE, BigDecimal.TEN); productReturnResponseDto = SaleTestHelper.createProductReturnResponseDto(product, buyer); }