test_class.declarator: hierarchyTreeNodeRepoMock
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private HierarchyTreeNodeRepository hierarchyTreeNodeRepoMock;
test_class.type: HierarchyTreeNodeRepository
test_class.var_name: hierarchyTreeNodeRepoMock
test_class.declarator: ldapAdapterMock
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private LdapAdapter ldapAdapterMock;
test_class.type: LdapAdapter
test_class.var_name: ldapAdapterMock
test_class.declarator: repoUserServiceMock
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private RepositoryUserService repoUserServiceMock;
test_class.type: RepositoryUserService
test_class.var_name: repoUserServiceMock
test_class.declarator: userDataRepoMock
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private UserDataRepository userDataRepoMock;
test_class.type: UserDataRepository
test_class.var_name: userDataRepoMock
test_class.declarator: normalizerMock
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private Normalizer<UserData> normalizerMock;
test_class.type: Normalizer<UserData>
test_class.var_name: normalizerMock
test_class.declarator: userDataCaptor
test_class.modifier: @Captor
      private
test_class.original_string: @Captor
      private ArgumentCaptor<Collection<UserData>> userDataCaptor;
test_class.type: ArgumentCaptor<Collection<UserData>>
test_class.var_name: userDataCaptor
test_class.declarator: userUpdater
test_class.modifier: private
test_class.original_string: private UserUpdater userUpdater;
test_class.type: UserUpdater
test_class.var_name: userUpdater
test_class.file: backend/project-board/src/test/java/de/adesso/projectboard/ad/updater/UserUpdaterTest.java
test_class.identifier: UserUpdaterTest
test_case.body: @Test
      public void buildHierarchyNodesReturnsExpectedNodes() {
          // given
          var firstRootUserId = "first-root-user";
          var secondRootUserId = "second-root-user";
          var firstRootChildUserId = "first-root-child-user";
          var secondRootChildUserId = "second-root-child-user";
  
          var firstRootUser = new User(firstRootUserId);
          var secondRootUser = new User(secondRootUserId);
          var firstRootChildUser = new User(firstRootChildUserId);
          var secondRootChildUser = new User(secondRootChildUserId);
  
          var firstRootDn = "first-root-dn";
          var secondRootDn = "second-root-dn";
          var firstRootChildDn = "first-root-child-dn";
          var secondRootChildDn = "second-root-child-dn";
  
          var firstRootNode = new LdapUserNode()
                  .setId(firstRootUserId)
                  .setDn(firstRootDn)
                  .setManagerDn(firstRootDn)
                  .setDirectReportsDn(List.of(firstRootChildDn));
          var firstRootChildNode = new LdapUserNode()
                  .setId(firstRootChildUserId)
                  .setDn(firstRootChildDn)
                  .setManagerDn(firstRootDn);
  
          var secondRootNode = new LdapUserNode()
                  .setId(secondRootUserId)
                  .setDn(secondRootDn)
                  .setManagerDn(secondRootDn)
                  .setDirectReportsDn(List.of(secondRootChildDn));
          var secondRootChildNode = new LdapUserNode()
                  .setId(secondRootChildUserId)
                  .setDn(secondRootChildDn)
                  .setManagerDn(secondRootDn);
  
          var firstRootChildHierarchyNode = new HierarchyTreeNode(firstRootChildUser);
          var expectedFirstRootHierarchyNode = new HierarchyTreeNode(firstRootUser);
          expectedFirstRootHierarchyNode.addDirectStaffMember(firstRootChildHierarchyNode);
  
          var secondRootChildHierarchyNode = new HierarchyTreeNode(secondRootChildUser);
          var expectedSecondRootHierarchyNode = new HierarchyTreeNode(secondRootUser);
          expectedSecondRootHierarchyNode.addDirectStaffMember(secondRootChildHierarchyNode);
  
          given(repoUserServiceMock.getOrCreateUserById(firstRootUserId)).willReturn(firstRootUser);
          given(repoUserServiceMock.getOrCreateUserById(firstRootChildUserId)).willReturn(firstRootChildUser);
          given(repoUserServiceMock.getOrCreateUserById(secondRootUserId)).willReturn(secondRootUser);
          given(repoUserServiceMock.getOrCreateUserById(secondRootChildUserId)).willReturn(secondRootChildUser);
  
          // when
          var actualRootHierarchyNodes = userUpdater.buildHierarchyTrees(List.of(firstRootNode, secondRootNode),
                  List.of(firstRootNode, secondRootNode, firstRootChildNode, secondRootChildNode));
  
          // then
          assertThat(actualRootHierarchyNodes).containsExactly(expectedFirstRootHierarchyNode, expectedSecondRootHierarchyNode);
      }
test_case.class_method_signature: UserUpdaterTest.buildHierarchyNodesReturnsExpectedNodes()
test_case.full_signature: @Test public void buildHierarchyNodesReturnsExpectedNodes()
test_case.identifier: buildHierarchyNodesReturnsExpectedNodes
test_case.invocations: setDirectReportsDn setManagerDn setDn setId of setManagerDn setDn setId setDirectReportsDn setManagerDn setDn setId of setManagerDn setDn setId addDirectStaffMember addDirectStaffMember willReturn given getOrCreateUserById willReturn given getOrCreateUserById willReturn given getOrCreateUserById willReturn given getOrCreateUserById buildHierarchyTrees of of containsExactly assertThat
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void buildHierarchyNodesReturnsExpectedNodes()
focal_class.declarator: hierarchyTreeNodeRepo
focal_class.modifier: private final
focal_class.original_string: private final HierarchyTreeNodeRepository hierarchyTreeNodeRepo;
focal_class.type: HierarchyTreeNodeRepository
focal_class.var_name: hierarchyTreeNodeRepo
focal_class.declarator: repoUserService
focal_class.modifier: private final
focal_class.original_string: private final RepositoryUserService repoUserService;
focal_class.type: RepositoryUserService
focal_class.var_name: repoUserService
focal_class.declarator: userDataRepo
focal_class.modifier: private final
focal_class.original_string: private final UserDataRepository userDataRepo;
focal_class.type: UserDataRepository
focal_class.var_name: userDataRepo
focal_class.declarator: ldapAdapter
focal_class.modifier: private final
focal_class.original_string: private final LdapAdapter ldapAdapter;
focal_class.type: LdapAdapter
focal_class.var_name: ldapAdapter
focal_class.declarator: normalizers
focal_class.modifier: private final
focal_class.original_string: private final List<Normalizer<UserData>> normalizers;
focal_class.type: List<Normalizer<UserData>>
focal_class.var_name: normalizers
focal_class.file: backend/project-board/src/main/java/de/adesso/projectboard/ad/updater/UserUpdater.java
focal_class.identifier: UserUpdater
focal_class.class_method_signature: UserUpdater.UserUpdater(HierarchyTreeNodeRepository hierarchyTreeNodeRepo,
                         RepositoryUserService repoUserService,
                         UserDataRepository userDataRepo,
                         LdapAdapter ldapAdapter,
                         List<Normalizer<UserData>> normalizers)
focal_class.full_signature: public  UserUpdater(HierarchyTreeNodeRepository hierarchyTreeNodeRepo,
                         RepositoryUserService repoUserService,
                         UserDataRepository userDataRepo,
                         LdapAdapter ldapAdapter,
                         List<Normalizer<UserData>> normalizers)
focal_class.identifier: UserUpdater
focal_class.modifiers: public
focal_class.parameters: (HierarchyTreeNodeRepository hierarchyTreeNodeRepo,
                         RepositoryUserService repoUserService,
                         UserDataRepository userDataRepo,
                         LdapAdapter ldapAdapter,
                         List<Normalizer<UserData>> normalizers)
focal_class.signature:  UserUpdater(HierarchyTreeNodeRepository hierarchyTreeNodeRepo,
                         RepositoryUserService repoUserService,
                         UserDataRepository userDataRepo,
                         LdapAdapter ldapAdapter,
                         List<Normalizer<UserData>> normalizers)
focal_class.class_method_signature: UserUpdater.updateHierarchyAndUserData()
focal_class.full_signature: public void updateHierarchyAndUserData()
focal_class.identifier: updateHierarchyAndUserData
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void updateHierarchyAndUserData()
focal_class.class_method_signature: UserUpdater.updateHierarchy(@NonNull Collection<LdapUserNode> nodes)
focal_class.full_signature:  void updateHierarchy(@NonNull Collection<LdapUserNode> nodes)
focal_class.identifier: updateHierarchy
focal_class.parameters: (@NonNull Collection<LdapUserNode> nodes)
focal_class.return: void
focal_class.signature: void updateHierarchy(@NonNull Collection<LdapUserNode> nodes)
focal_class.class_method_signature: UserUpdater.updateUserData(@NonNull Collection<LdapUserNode> nodes)
focal_class.full_signature:  void updateUserData(@NonNull Collection<LdapUserNode> nodes)
focal_class.identifier: updateUserData
focal_class.parameters: (@NonNull Collection<LdapUserNode> nodes)
focal_class.return: void
focal_class.signature: void updateUserData(@NonNull Collection<LdapUserNode> nodes)
focal_class.class_method_signature: UserUpdater.normalizeAndSaveUserData(List<UserData> userData)
focal_class.full_signature:  void normalizeAndSaveUserData(List<UserData> userData)
focal_class.identifier: normalizeAndSaveUserData
focal_class.parameters: (List<UserData> userData)
focal_class.return: void
focal_class.signature: void normalizeAndSaveUserData(List<UserData> userData)
focal_class.class_method_signature: UserUpdater.getRootNodes(@NonNull Collection<LdapUserNode> nodes)
focal_class.full_signature:  Set<LdapUserNode> getRootNodes(@NonNull Collection<LdapUserNode> nodes)
focal_class.identifier: getRootNodes
focal_class.parameters: (@NonNull Collection<LdapUserNode> nodes)
focal_class.return: Set<LdapUserNode>
focal_class.signature: Set<LdapUserNode> getRootNodes(@NonNull Collection<LdapUserNode> nodes)
focal_class.class_method_signature: UserUpdater.buildHierarchyTrees(@NonNull Collection<LdapUserNode> rootNodes, @NonNull Collection<LdapUserNode> allNodes)
focal_class.full_signature:  Collection<HierarchyTreeNode> buildHierarchyTrees(@NonNull Collection<LdapUserNode> rootNodes, @NonNull Collection<LdapUserNode> allNodes)
focal_class.identifier: buildHierarchyTrees
focal_class.parameters: (@NonNull Collection<LdapUserNode> rootNodes, @NonNull Collection<LdapUserNode> allNodes)
focal_class.return: Collection<HierarchyTreeNode>
focal_class.signature: Collection<HierarchyTreeNode> buildHierarchyTrees(@NonNull Collection<LdapUserNode> rootNodes, @NonNull Collection<LdapUserNode> allNodes)
focal_class.class_method_signature: UserUpdater.buildHierarchyNode(@NonNull LdapUserNode rootNode, @NonNull List<LdapUserNode> childNodes)
focal_class.full_signature:  HierarchyTreeNode buildHierarchyNode(@NonNull LdapUserNode rootNode, @NonNull List<LdapUserNode> childNodes)
focal_class.identifier: buildHierarchyNode
focal_class.parameters: (@NonNull LdapUserNode rootNode, @NonNull List<LdapUserNode> childNodes)
focal_class.return: HierarchyTreeNode
focal_class.signature: HierarchyTreeNode buildHierarchyNode(@NonNull LdapUserNode rootNode, @NonNull List<LdapUserNode> childNodes)
focal_class.class_method_signature: UserUpdater.getChildNodesInLevelOrder(@NonNull LdapUserNode node, @NonNull Map<String, LdapUserNode> dnNodeMap)
focal_class.full_signature:  List<LdapUserNode> getChildNodesInLevelOrder(@NonNull LdapUserNode node, @NonNull Map<String, LdapUserNode> dnNodeMap)
focal_class.identifier: getChildNodesInLevelOrder
focal_class.parameters: (@NonNull LdapUserNode node, @NonNull Map<String, LdapUserNode> dnNodeMap)
focal_class.return: List<LdapUserNode>
focal_class.signature: List<LdapUserNode> getChildNodesInLevelOrder(@NonNull LdapUserNode node, @NonNull Map<String, LdapUserNode> dnNodeMap)
focal_class.class_method_signature: UserUpdater.filterNodesWithMissingManager(@NonNull Collection<LdapUserNode> nodes)
focal_class.full_signature:  Set<LdapUserNode> filterNodesWithMissingManager(@NonNull Collection<LdapUserNode> nodes)
focal_class.identifier: filterNodesWithMissingManager
focal_class.parameters: (@NonNull Collection<LdapUserNode> nodes)
focal_class.return: Set<LdapUserNode>
focal_class.signature: Set<LdapUserNode> filterNodesWithMissingManager(@NonNull Collection<LdapUserNode> nodes)
focal_class.class_method_signature: UserUpdater.cleanDirectReports(@NonNull Collection<LdapUserNode> nodes)
focal_class.full_signature:  Set<LdapUserNode> cleanDirectReports(@NonNull Collection<LdapUserNode> nodes)
focal_class.identifier: cleanDirectReports
focal_class.parameters: (@NonNull Collection<LdapUserNode> nodes)
focal_class.return: Set<LdapUserNode>
focal_class.signature: Set<LdapUserNode> cleanDirectReports(@NonNull Collection<LdapUserNode> nodes)
focal_method.body: Collection<HierarchyTreeNode> buildHierarchyTrees(@NonNull Collection<LdapUserNode> rootNodes, @NonNull Collection<LdapUserNode> allNodes) {
          var dnNodeMap = allNodes.stream()
                  .collect(Collectors.toMap(LdapUserNode::getDn, Function.identity()));
  
          return rootNodes.stream()
                  .map(rootNode -> {
                      var childNodesInLevelOrder = getChildNodesInLevelOrder(rootNode, dnNodeMap);
  
                      return buildHierarchyNode(rootNode, childNodesInLevelOrder);
                  })
                  .collect(Collectors.toList());
      }
focal_method.class_method_signature: UserUpdater.buildHierarchyTrees(@NonNull Collection<LdapUserNode> rootNodes, @NonNull Collection<LdapUserNode> allNodes)
focal_method.full_signature:  Collection<HierarchyTreeNode> buildHierarchyTrees(@NonNull Collection<LdapUserNode> rootNodes, @NonNull Collection<LdapUserNode> allNodes)
focal_method.identifier: buildHierarchyTrees
focal_method.invocations: collect stream toMap identity collect map stream getChildNodesInLevelOrder buildHierarchyNode toList
focal_method.parameters: (@NonNull Collection<LdapUserNode> rootNodes, @NonNull Collection<LdapUserNode> allNodes)
focal_method.return: Collection<HierarchyTreeNode>
focal_method.signature: Collection<HierarchyTreeNode> buildHierarchyTrees(@NonNull Collection<LdapUserNode> rootNodes, @NonNull Collection<LdapUserNode> allNodes)