Conversation
Jelors
commented
Jan 8, 2026
Owner
…ies to test section
Elena-Bruyako
suggested changes
Jan 10, 2026
Comment on lines
+35
to
+37
| @Sql(scripts = "classpath:database/books/add-items-to-categories-table.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) | ||
| @Sql(scripts = "classpath:database/books/add-three-items-to-books-table.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) | ||
| @Sql(scripts = "classpath:database/books/assign-categories-for-books.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) |
There was a problem hiding this comment.
BEFORE_TEST_METHOD is by default
Suggested change
| @Sql(scripts = "classpath:database/books/add-items-to-categories-table.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) | |
| @Sql(scripts = "classpath:database/books/add-three-items-to-books-table.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) | |
| @Sql(scripts = "classpath:database/books/assign-categories-for-books.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) | |
| @Sql(scripts = {"classpath:database/books/add-items-to-categories-table.sql", "classpath:database/books/add-three-items-to-books-table.sql", | |
| "classpath:database/books/assign-categories-for-books.sql"}) |
|
|
||
| Map<String, Object> responseMap = objectMapper.readValue(jsonResponse, new TypeReference<>() { | ||
| }); | ||
| Assertions.assertEquals(3, responseMap.get("totalElements")); |
There was a problem hiding this comment.
use static imports
check all places
|
|
||
| String jsonResponse = result.getResponse().getContentAsString(); | ||
|
|
||
| assertTrue(jsonResponse.contains("Kobzar")); |
| @AutoConfigureMockMvc | ||
| @WithMockUser(username = "admin", roles = {"ADMIN"}) | ||
| @Sql(scripts = "classpath:database/books/categories/add-five-items-to-categories-table.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) | ||
| @Sql(scripts = "classpath:database/books/add-three-items-to-books-table.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) |
There was a problem hiding this comment.
same comments as in BookControllerTest
Elena-Bruyako
suggested changes
Jan 10, 2026
Comment on lines
+159
to
+163
| assertEquals(expected.getId(), actual.getId()); | ||
| assertEquals(expected.getAuthor(), actual.getAuthor()); | ||
| assertEquals(expected.getTitle(), actual.getTitle()); | ||
| assertEquals(expected.getPrice(), actual.getPrice()); | ||
| assertEquals(expected.getCategoryIds(), actual.getCategoryIds()); |
There was a problem hiding this comment.
check other places, don't complicate code
Suggested change
| assertEquals(expected.getId(), actual.getId()); | |
| assertEquals(expected.getAuthor(), actual.getAuthor()); | |
| assertEquals(expected.getTitle(), actual.getTitle()); | |
| assertEquals(expected.getPrice(), actual.getPrice()); | |
| assertEquals(expected.getCategoryIds(), actual.getCategoryIds()); | |
| assertEquals(expected, actual); |
| } | ||
| ); | ||
| assertEquals(5, actualDtos.size()); | ||
| assertEquals("Fantasy", actualDtos.get(0).getName()); |
| .thenReturn(bookDto); | ||
| BookDto actual = bookService.save(requestDto); | ||
|
|
||
| EqualsBuilder.reflectionEquals(bookEntity, actual, "id"); |
There was a problem hiding this comment.
always use assertTrue before reflectionEquals
check other places
Suggested change
| EqualsBuilder.reflectionEquals(bookEntity, actual, "id"); | |
| assertTrue(EqualsBuilder.reflectionEquals(bookEntity, actual, "id")); |
|
|
||
| bookService.deleteBookById(1L); | ||
|
|
||
| Mockito.verify(bookRepository) |
There was a problem hiding this comment.
use static imports
check all places
Elena-Bruyako
approved these changes
Jan 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.