Skip to content

Cannot assert status reason phrase with MockMvcTester #34016

Closed
@mahozad

Description

@mahozad

When using MockMvc the status reason phrase can be asserted like this:

mockMvc
    .perform(get("/something"))
    .andExpect(status().isNotFound())
    .andExpect(status().reason("Could not find xyz"))

This cannot be achieved using MockMvcTester:

val result = mockMvc.get().uri("/something")
assertThat(result)
    .hasStatus(HttpStatus.NOT_FOUND)
    // ??? How to assert the status reason phrase

Is there something I'm missing?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions