@Override
    public Product updateProductById(String productId, ProductUpdateRequest productUpdateRequest) {

        checkProductNameUniqueness(productUpdateRequest.getName());

        final ProductEntity productEntityToBeUpdate = productRepository
                .findById(productId)
                .orElseThrow(() -> new ProductNotFoundException("With given productID = " + productId));

        productUpdateRequestToProductEntityMapper.mapForUpdating(productEntityToBeUpdate, productUpdateRequest);

        ProductEntity updatedProductEntity = productRepository.save(productEntityToBeUpdate);

        return productEntityToProductMapper.map(updatedProductEntity);

    }
@Test
    void givenProductUpdateRequest_whenProductUpdated_thenReturnProduct() {

        // Given
        String productId = "1";
        String newProductName = "New Product Name";

        ProductUpdateRequest productUpdateRequest = ProductUpdateRequest.builder()
                .name(newProductName)
                .amount(BigDecimal.valueOf(5))
                .unitPrice(BigDecimal.valueOf(12))
                .build();

        ProductEntity existingProductEntity = ProductEntity.builder()
                .id(productId)
                .name(productUpdateRequest.getName())
                .unitPrice(productUpdateRequest.getUnitPrice())
                .amount(productUpdateRequest.getAmount())
                .build();

        productUpdateRequestToProductEntityMapper.mapForUpdating(existingProductEntity,productUpdateRequest);

        Product expected = productEntityToProductMapper.map(existingProductEntity);

        // When
        when(productRepository.findById(productId)).thenReturn(Optional.of(existingProductEntity));
        when(productRepository.existsProductEntityByName(newProductName)).thenReturn(false);
        when(productRepository.save(any(ProductEntity.class))).thenReturn(existingProductEntity);

        // Then
        Product updatedProduct = productUpdateService.updateProductById(productId, productUpdateRequest);

        // Then
        assertNotNull(updatedProduct);
        assertEquals(expected.getId(), updatedProduct.getId());
        assertEquals(expected.getName(), updatedProduct.getName());
        assertEquals(expected.getAmount(), updatedProduct.getAmount());
        assertEquals(expected.getUnitPrice(), updatedProduct.getUnitPrice());

        // Verify
        verify(productRepository, times(1)).findById(productId);
        verify(productRepository, times(1)).existsProductEntityByName(newProductName);
        verify(productRepository, times(1)).save(any(ProductEntity.class));

    }