-
Notifications
You must be signed in to change notification settings - Fork 0
Problem with tests #3
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
Conversation
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.
Hey, looks good. Just a couple of suggestions form me
src/test/java/com/example/postgresdemo/controller/QuestionControllerTest.java
Outdated
Show resolved
Hide resolved
src/test/java/com/example/postgresdemo/controller/QuestionControllerTest.java
Outdated
Show resolved
Hide resolved
src/test/java/com/example/postgresdemo/controller/QuestionControllerTest.java
Outdated
Show resolved
Hide resolved
src/test/java/com/example/postgresdemo/controller/QuestionControllerTest.java
Outdated
Show resolved
Hide resolved
src/test/java/com/example/postgresdemo/controller/QuestionControllerTest.java
Outdated
Show resolved
Hide resolved
src/test/java/com/example/postgresdemo/controller/QuestionControllerTest.java
Outdated
Show resolved
Hide resolved
.contentType(MediaType.APPLICATION_JSON)) | ||
.andExpect(status().isOk()) | ||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) | ||
.andExpect(MockMvcResultMatchers.jsonPath("$.content.length()", Matchers.equalTo(Math.min(assertionNumber, pageSize)))) |
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.
Math.min(assertionNumber, pageSize)
- I think you are mixing 2 test cases in 1 test here:
- First test case is to check whether
/questions
endpoint returns the list with all the questions (it's the case when assertionNumber <= pageSize ) - Second case is to check whether
/questions
endpoint returns a list of elements with maximum length ofpageSize
I think it's worth separating these cases into two @Test
methods.
No description provided.