I want to make tests for create and update APIs in Spring Boot:
@Test
public void shouldCreateNewUser() throws Exception, UserAlreadyExistException {
    User user = User.builder()
            .id(10L)
            .firstName("Alin")
            .lastName("Balan")
            .mail("alin@yahoo.com")
            .password("pass")
            .isAdmin(true)
            .role(Roles.PTE)
            .build();
    mvc.perform(MockMvcRequestBuilders.post("/api/users")
            .contentType(MediaType.APPLICATION_JSON)
            .content(mapper.writeValueAsString(user)))
            .andExpect(status().isOk())
            .andExpect(MockMvcResultMatchers.jsonPath("$[10].id",is(10)));
    Mockito.verify(userService, Mockito.times(1)).save(Mockito.any());
}
But I have this error
java.lang.AssertionError: No value at JSON path "$[10].id", exception: json can not be null or empty
 
     
    