I'm trying to test a REST API. For this I use the following code. However, Intellij gives me the error in the last line:
Not enough information to infer type variable T.
import org.hamcrest.Matchers.hasSize
mockMvc.perform(get("/api/users"))
.andDo(print())
.andExpect(status().isOk)
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$").isNotEmpty)
.andExpect(jsonPath("$").isArray)
.andExpect(jsonPath("$.*", hasSize(2)));