@Test
public void updateUser() throws Exception {

    User userToUpdate = _userRepo.findOneByUsername("testuser-editor");
    Assert.assertNotNull(userToUpdate);
    UserDto user = new UserDto();
    user.setUsername(userToUpdate.getUsername());
    user.setName(userToUpdate.getName() + "-updated");
    user.setProfile(userToUpdate.getProfile().toString());
    user.setGroupsEditor(Collections.singletonList("2"));
    user.setEmail(new ArrayList(userToUpdate.getEmailAddresses()));
    user.setEnabled(true);
    Gson gson = new Gson();
    String json = gson.toJson(user);
    this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
    this.mockHttpSession = loginAsAdmin();
    this.mockMvc.perform(put("/srv/api/users/" + userToUpdate.getId())
        .content(json)
        .contentType(API_JSON_EXPECTED_ENCODING)
        .session(this.mockHttpSession)
        .accept(MediaType.parseMediaType("application/json")))
        .andExpect(status().is(204));
}