Skip to content

Commit

Permalink
make some adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan0dyatlyukkk committed Oct 27, 2023
1 parent f0344c8 commit deef713
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class CartControllerTest {
private static final Book TEST_BOOK = new Book();
private static final int TEST_BOOK_QUANTITY = 5;
private static final CartItemDto TEST_CART_ITEM_DTO = new CartItemDto();
private static final CartItemDto DEFAULT_CART_ITEM_DTO = new CartItemDto();
private static final int UPDATED_CART_ITEM_QUANTITY = 10;
private static final Long DEFAULT_CART_ITEM_ID = 1L;
private static final String DEFAULT_BOOK_TITLE = "Test";
Expand Down Expand Up @@ -78,9 +79,15 @@ static void beforeAll(
TEST_BOOK.setTitle("The book 5");
TEST_BOOK.setAuthor("ADMIN ADMIN");

TEST_CART_ITEM_DTO.setId(1L);
TEST_CART_ITEM_DTO.setBookId(TEST_BOOK.getId());
TEST_CART_ITEM_DTO.setBookTitle(TEST_BOOK.getTitle());
TEST_CART_ITEM_DTO.setQuantity(TEST_BOOK_QUANTITY);

DEFAULT_CART_ITEM_DTO.setId(1L);
DEFAULT_CART_ITEM_DTO.setBookId(4L);
DEFAULT_CART_ITEM_DTO.setBookTitle("Test");
DEFAULT_CART_ITEM_DTO.setQuantity(1);
}

@BeforeEach
Expand Down Expand Up @@ -141,6 +148,7 @@ void get_returnsShoppingCart() throws Exception {

assertNotNull(shoppingCartDto);
assertEquals(TEST_USER.getId(), shoppingCartDto.getUserId());
assertTrue(shoppingCartDto.getCartItems().contains(DEFAULT_CART_ITEM_DTO));
}

@WithMockUser(username = TEST_USER_NAME)
Expand Down

0 comments on commit deef713

Please sign in to comment.