Skip to content

Commit

Permalink
feat: remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
rajadilipkolli committed Nov 13, 2023
1 parent dc869ed commit 477564a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/sonar-cloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
uses: actions/setup-java@v3
with:
java-version: 21
distribution: 'zulu' # Alternative distribution options are available.
distribution: 'microsoft' # Alternative distribution options are available.
cache: 'maven'

- name: Cache SonarCloud packages
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,20 @@ Licensed under MIT License Copyright (c) 2021-2023 Raja Kolli.
import com.example.catalogservice.entities.Product;
import com.example.catalogservice.model.request.ProductRequest;
import com.example.catalogservice.model.response.ProductResponse;
import com.example.common.dtos.ProductDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget;

@Mapper(componentModel = "spring")
public interface ProductMapper {

@Mapping(target = "id", ignore = true)
@Mapping(target = "inStock", ignore = true)
Product toEntity(ProductDto productDto);

@Mapping(target = "withInStock", ignore = true)
ProductResponse toProductResponse(Product product);

@Mapping(target = "id", ignore = true)
@Mapping(target = "inStock", ignore = true)
Product toEntity(ProductRequest productRequest);

Product toEntity(ProductResponse productResponse);

@Mapping(target = "inStock", ignore = true)
@Mapping(target = "id", ignore = true)
void mapProductWithRequest(ProductRequest productRequest, @MappingTarget Product product);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Licensed under MIT License Copyright (c) 2021-2023 Raja Kolli.
package com.example.catalogservice.web.controllers;

import static com.example.catalogservice.utils.AppConstants.PROFILE_TEST;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;

Expand Down Expand Up @@ -69,20 +69,21 @@ void shouldFetchAllProducts() {
.isOk()
.expectBody(PagedResult.class)
.value(
response -> {
assertAll(
() -> assertTrue(response.isFirst()),
() -> assertTrue(response.isLast()),
() -> assertFalse(response.hasNext()),
() -> assertFalse(response.hasPrevious()),
() -> assertEquals(3, response.totalElements()),
() -> assertEquals(1, response.pageNumber()),
() -> assertEquals(1, response.totalPages()),
() ->
assertEquals(
productResponseList.size(),
response.data().size()));
});
response ->
assertThat(response)
.isNotNull()
.satisfies(
r -> {
assertThat(r.isFirst()).isTrue();
assertThat(r.isLast()).isTrue();
assertThat(r.hasNext()).isFalse();
assertThat(r.hasPrevious()).isFalse();
assertThat(r.totalElements()).isEqualTo(3);
assertThat(r.pageNumber()).isEqualTo(1);
assertThat(r.totalPages()).isEqualTo(1);
assertThat(r.data().size())
.isEqualTo(productResponseList.size());
}));
}

@Test
Expand Down

0 comments on commit 477564a

Please sign in to comment.