RepositoryUserService implements UserService { UserData copyAndSetThumbnailPhoto(@NonNull UserData userData, byte[] thumbnailPhoto) { var id = userData.getId(); var user = userData.getUser(); var firstName = userData.getFirstName(); var lastName = userData.getLastName(); var email = userData.getEmail(); var lob = userData.getLob(); return new UserData(user, firstName, lastName, email, lob, thumbnailPhoto) .setId(id); } RepositoryUserService(UserRepository userRepo,
                                 UserDataRepository dataRepo,
                                 LdapAdapter ldapAdapter,
                                 HierarchyTreeNodeRepository hierarchyTreeNodeRepo,
                                 HibernateSearchService hibernateSearchService); @Override boolean userExists(@NonNull String userId); @Override boolean userIsManager(@NonNull User user); @Override HierarchyTreeNode getHierarchyForUser(@NonNull User user); @Override UserData getUserData(@NonNull User user); @Override User getUserById(@NonNull String userId); @Override boolean userHasStaffMember(@NonNull User user, @NonNull User staffMember); @Override User getManagerOfUser(@NonNull User user); @Override List<UserData> getStaffMemberUserDataOfUser(@NonNull User user, @NonNull Sort sort); @Override List<UserData> searchStaffMemberDataOfUser(User user, String query, Sort sort); @Override List<User> getStaffMembersOfUser(@NonNull User user); @Override User save(@NonNull User user); @Override void delete(User user); @Override void deleteUserById(String userId); @Override Map<User, Boolean> usersAreManagers(@NonNull Set<User> users); User getOrCreateUserById(@NonNull String userId); @Override void removeAllApplicationsOfUser(User user);  }
@Test public void copyAndSetThumbnailPhotoCopiesAttributesAndSetsThumbnail() { var thumbnailPhoto = new byte[] {-1, 2, -3, 4}; var expectedId = 2L; var expectedFirstName = "First"; var expectedLastName = "Last"; var expectedMail = "mail@test.com"; var expectedLob = "LoB Test"; var expectedData = new UserData(userMock, expectedFirstName, expectedLastName, expectedMail, expectedLob, thumbnailPhoto) .setId(expectedId) .setPictureInitialized(true); var preInitialized = new UserData(userMock, expectedFirstName, expectedLastName, expectedMail, expectedLob) .setId(expectedId); var actualData = repoUserService.copyAndSetThumbnailPhoto(preInitialized, thumbnailPhoto); assertThat(actualData).isEqualTo(expectedData); }