@Test public void getStaffMembersOfUserReturnsDirectStaffMembersOfUser() { given(hierarchyTreeNodeRepoMock.findByUser(userMock)).willReturn(Optional.of(hierarchyTreeNodeMock)); given(hierarchyTreeNodeMock.getDirectStaff()).willReturn(List.of(otherHierarchyTreeNodeMock)); given(otherHierarchyTreeNodeMock.getUser()).willReturn(otherUserMock); var actualStaff = repoUserService.getStaffMembersOfUser(userMock); assertThat(actualStaff).containsExactly(otherUserMock); }
@Override public List<User> getStaffMembersOfUser(@NonNull User user) { return getHierarchyForUser(user).getDirectStaff().stream() .map(HierarchyTreeNode::getUser) .collect(Collectors.toList()); }
RepositoryUserService implements UserService { @Override public List<User> getStaffMembersOfUser(@NonNull User user) { return getHierarchyForUser(user).getDirectStaff().stream() .map(HierarchyTreeNode::getUser) .collect(Collectors.toList()); } }
RepositoryUserService implements UserService { @Override public List<User> getStaffMembersOfUser(@NonNull User user) { return getHierarchyForUser(user).getDirectStaff().stream() .map(HierarchyTreeNode::getUser) .collect(Collectors.toList()); } RepositoryUserService(UserRepository userRepo,
                                 UserDataRepository dataRepo,
                                 LdapAdapter ldapAdapter,
                                 HierarchyTreeNodeRepository hierarchyTreeNodeRepo,
                                 HibernateSearchService hibernateSearchService); }
RepositoryUserService implements UserService { @Override public List<User> getStaffMembersOfUser(@NonNull User user) { return getHierarchyForUser(user).getDirectStaff().stream() .map(HierarchyTreeNode::getUser) .collect(Collectors.toList()); } 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); }
RepositoryUserService implements UserService { @Override public List<User> getStaffMembersOfUser(@NonNull User user) { return getHierarchyForUser(user).getDirectStaff().stream() .map(HierarchyTreeNode::getUser) .collect(Collectors.toList()); } 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);  }