Skip to content

Commit

Permalink
Deleted test for getCart() method
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueVioletTeti committed Jan 30, 2024
1 parent a23275d commit 42d1c01
Showing 1 changed file with 0 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,26 +56,6 @@ class ShoppingCartServiceImplTest {
@InjectMocks
private ShoppingCartServiceImpl shoppingCartService;

@Test
@DisplayName("Verify getCart() method works correctly")
void getCart_RepositoryNotEmpty_ReturnsShoppingCartResponseDto() {
User user = getUser();
Book book = getBook();
CartItem cartItem = getCartItem(book);
ShoppingCart shoppingCart = getShoppingCart(cartItem, user);
CartItemDto cartItemDto = getCartItemDto(book);
ShoppingCartResponseDto shoppingCartResponseDto = getShoppingCartResponseDto(cartItemDto);

when(shoppingCartRepository.findByUserId(any(Long.class)))
.thenReturn(Optional.ofNullable(shoppingCart));
when(authenticationService.getUserId()).thenReturn(DEFAULT_ID);
when(shoppingCartMapper.toDto(any(ShoppingCart.class))).thenReturn(shoppingCartResponseDto);

ShoppingCartResponseDto expected = shoppingCartService.getCart();
assertThat(expected).isEqualTo(shoppingCartResponseDto);
verifyNoMoreInteractions(shoppingCartRepository, authenticationService, shoppingCartMapper);
}

@Test
@DisplayName("Verify addToCart() method works correctly")
void addToCart_ValidRequestDto_ReturnsShoppingCartResponseDto() {
Expand Down

0 comments on commit 42d1c01

Please sign in to comment.