@Test public void updateUser() { ExternalUser user = createUserWithRandomUserName(Role.authenticated); UpdateUserRequest request = new UpdateUserRequest(); request.setFirstName("foo"); request.setLastName("bar"); request.setEmailAddress("*****@*****.**"); userService.saveUser(user.getId(), request); User loadedUser = userRepository.findByUuid(user.getId()); assertThat(loadedUser.getFirstName(), is("foo")); assertThat(loadedUser.getLastName(), is("bar")); assertThat(loadedUser.getEmailAddress(), is("*****@*****.**")); }
private void assertOnCreatedUser(ExternalUser user) throws Exception { assertThat(user, is(notNullValue())); User foundUser = userRepository.findByUuid(user.getId().toString()); assertThat(foundUser, is(notNullValue())); assertThat(foundUser.getSessions().last().getToken(), is(notNullValue())); assertThat( foundUser.getSessions().last().getToken(), is(user.getSessions().get(user.getSessions().size() - 1).getSessionToken())); assertThat(foundUser.hasRole(Role.anonymous), is(false)); assertThat(foundUser.hasRole(Role.authenticated), is(true)); assertThat(foundUser.isVerified(), is(false)); }