Example #1
0
  @Test
  public void updateTest() {
    User user = getUser(UserRole.ROLE_ORG_USER, UserRole.ROLE_GROUP_USER);
    user.setLastName("Tester");

    user = userService.getByEmail(user.getEmail());
    userService.update(user);
    assertEquals(user.getLastName(), "Tester");
  }
  protected User getUser() {
    if (user == null) {
      MessageDigestPasswordEncoder passwordEncoder =
          new MessageDigestPasswordEncoder("SHA-256", true);
      user = new User();
      user.setEmail("*****@*****.**");
      user.setFirstName("John");
      user.setLastName("Doe");
      user.setUsername("*****@*****.**");
      user.setPassword(passwordEncoder.encodePassword("1234", user.getEmail()));
      user.setActivationCode(UUID.randomUUID().toString());
      user.getUuid();

      userService.add(user);
    }

    return user;
  }