コード例 #1
0
ファイル: UserServiceTest.java プロジェクト: Sathis/rest-java
 @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("*****@*****.**"));
 }
コード例 #2
0
ファイル: UserServiceTest.java プロジェクト: Sathis/rest-java
 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));
 }