1

when using mockMvc.perform to Test my Web-Application I'm trying to use .content(someJson) to meet the requirements for the body. Unfortunately, when using .content it appears red with the error:

Cannot resolve method 'content' in 'ResultActions'

The request looks like this:

mockMvc
    .perform(
        MockMvcRequestBuilders.post("/api/test/url")
            .with(httpBasic(authorizedUsername, auhorizedPassword))
            .header("user", id)
            .secure(true)
            .contentType(MediaType.APPLICATION_JSON)
            .content(someJson),
    )
    .andExpect(status().isCreated());

I can't figure out why that is. Any help for a struggling colleague?

Thanks!

1 Answers1

1

the closing clip was missplaced...