### Question:
UserController { @PutMapping("/profile/{username}") public Profile updateUserProfile( @PathVariable String username, @RequestBody Profile updatedProfile) throws Exception { return userService.updateProfileByUsername(username, updatedProfile); }  @GetMapping("/users") Iterable<User> getAllUsers(); @GetMapping("/exists/username/{username}") boolean existsUsername(@PathVariable String username); @GetMapping("/exists/email/{email}") boolean existsEmail(@PathVariable String email); @PostMapping("/signup") User insertUser(@RequestBody User newUser); @GetMapping("/profile/{username}") Profile getUserProfile(@PathVariable String username); @PutMapping("/profile/{username}") Profile updateUserProfile(
            @PathVariable String username, @RequestBody Profile updatedProfile); @PostMapping("/password/{userId}/matches") boolean passwordMatches(
            @PathVariable Integer userId, @RequestBody AuthenticationRequest plainPassword); @PutMapping("/password/{userId}/update") String passwordUpdate(
            @PathVariable Integer userId, @RequestBody AuthenticationRequest plainPassword); @DeleteMapping("/users/{userId}") void deleteUserAccount(@PathVariable Integer userId);  }### Answer:
@WithMockUser("spring") @Test @Order(5) public void updateUserProfile() throws Exception { String url = "/profile/abcdefg"; User editUser = this.repository.findByUsername("abcdefg").get(); editUser.setLastname("ef1"); editUser.setCountry("Greece"); String json = mapper.writeValueAsString(editUser); mvc.perform( MockMvcRequestBuilders.put(url) .content(json) .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andExpect(jsonPath("$.email").value("abcd@efg")) .andExpect(jsonPath("$.firstname").value("abcd")) .andExpect(jsonPath("$.lastname").value("ef1")) .andExpect(jsonPath("$.country").value("Greece")); }