-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
…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
There was a problem hiding this 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.
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()); | ||
|
There was a problem hiding this comment.
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 ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job!
No description provided.