@Test
public void createUser() throws Exception {

    UserDto user = new UserDto();
    user.setUsername("newuser");
    user.setName("new");
    user.setProfile(Profile.Editor.name());
    user.setGroupsEditor(Collections.singletonList("2"));
    user.setEmail(Collections.singletonList("mail@test.com"));
    user.setPassword("password");
    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")
        .content(json)
        .contentType(API_JSON_EXPECTED_ENCODING)
        .session(this.mockHttpSession)
        .accept(MediaType.parseMediaType("application/json")))
        .andExpect(status().is(204));
    User userCreated = _userRepo.findOneByUsername(user.getUsername());
    Assert.assertNotNull(userCreated);
}