Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests book category dev #16

Merged
merged 5 commits into from
Jan 30, 2024
Merged

Tests book category dev #16

merged 5 commits into from
Jan 30, 2024

Conversation

don-bigdad
Copy link
Owner

No description provided.

…sts-book-category-dev

# Conflicts:
#	src/test/java/com/example/springbootbookshop/controller/BookControllerTest.java
#	src/test/java/com/example/springbootbookshop/controller/CategoryControllerTest.java
#	src/test/java/com/example/springbootbookshop/service/BookServiceTest.java
Copy link

@liliia-ponomarenko liliia-ponomarenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more mistake. Let’s return to the message that I sent you in private chat. You should use the repository if you want to check DB data. Please don’t call another endpoint in the method that doesn't have any relation to this test case.

Comment on lines 177 to 184
MvcResult result = mockMvc.perform(get("/books/2")
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andReturn();
BookDto dto = objectMapper.readValue(result.getResponse()
.getContentAsString(), BookDto.class);
assertEquals("Book 2", dto.getTitle());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you test the update in this case. Don’t call the method get here ;)

Copy link

@liliia-ponomarenko liliia-ponomarenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job!

@don-bigdad don-bigdad merged commit cb8ef63 into master Jan 30, 2024
3 checks passed
@don-bigdad don-bigdad deleted the tests-book-category-dev branch January 30, 2024 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants