Skip to content

Conversation

ZaharKalosha
Copy link
Owner

No description provided.

Copy link

@Anton-Oparin Anton-Oparin left a 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

.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))))

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 of pageSize

I think it's worth separating these cases into two @Test methods.

@ZaharKalosha ZaharKalosha merged commit 095cf1c into master Jun 14, 2024
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