test_class.declarator: userMock
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private User userMock;
test_class.type: User
test_class.var_name: userMock
test_class.declarator: otherUserMock
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private User otherUserMock;
test_class.type: User
test_class.var_name: otherUserMock
test_class.file: backend/project-board/src/test/java/de/adesso/projectboard/base/user/persistence/hierarchy/HierarchyTreeNodeTest.java
test_class.identifier: HierarchyTreeNodeTest
test_case.body: @Test
      public void addDirectStaffMemberAddsNodeToItselfAndAllParents() {
          // given
          var rootNode = new HierarchyTreeNode(userMock);
          rootNode.managingUser = true;
  
          var managerNode = new HierarchyTreeNode(otherUserMock);
          managerNode.manager = rootNode;
          rootNode.staff.add(managerNode);
          rootNode.directStaff.add(managerNode);
  
          var nodeToAdd = new HierarchyTreeNode(userMock);
  
          // when
          managerNode.addDirectStaffMember(nodeToAdd);
  
          // then
          var softly = new SoftAssertions();
  
          softly.assertThat(rootNode.staff).containsExactlyInAnyOrder(managerNode, nodeToAdd);
          softly.assertThat(rootNode.directStaff).containsExactlyInAnyOrder(managerNode);
          softly.assertThat(rootNode.managingUser).isTrue();
  
          softly.assertThat(managerNode.manager).isSameAs(rootNode);
          softly.assertThat(managerNode.staff).containsExactlyInAnyOrder(nodeToAdd);
          softly.assertThat(managerNode.directStaff).containsExactlyInAnyOrder(nodeToAdd);
          softly.assertThat(managerNode.managingUser).isTrue();
  
          softly.assertThat(nodeToAdd.manager).isSameAs(managerNode);
          softly.assertThat(nodeToAdd.staff).isEmpty();
          softly.assertThat(nodeToAdd.directStaff).isEmpty();
          softly.assertThat(nodeToAdd.managingUser).isFalse();
  
          softly.assertAll();
      }
test_case.class_method_signature: HierarchyTreeNodeTest.addDirectStaffMemberAddsNodeToItselfAndAllParents()
test_case.full_signature: @Test public void addDirectStaffMemberAddsNodeToItselfAndAllParents()
test_case.identifier: addDirectStaffMemberAddsNodeToItselfAndAllParents
test_case.invocations: add add addDirectStaffMember containsExactlyInAnyOrder assertThat containsExactlyInAnyOrder assertThat isTrue assertThat isSameAs assertThat containsExactlyInAnyOrder assertThat containsExactlyInAnyOrder assertThat isTrue assertThat isSameAs assertThat isEmpty assertThat isEmpty assertThat isFalse assertThat assertAll
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void addDirectStaffMemberAddsNodeToItselfAndAllParents()
focal_class.declarator: id
focal_class.modifier: @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
focal_class.original_string: @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      Long id;
focal_class.type: Long
focal_class.var_name: id
focal_class.declarator: manager
focal_class.modifier: @ManyToOne
      @JoinColumn(
              name = "MANAGER_NODE_ID"
      )
focal_class.original_string: @ManyToOne
      @JoinColumn(
              name = "MANAGER_NODE_ID"
      )
      HierarchyTreeNode manager;
focal_class.type: HierarchyTreeNode
focal_class.var_name: manager
focal_class.declarator: directStaff
focal_class.modifier: @OneToMany(
              mappedBy = "manager",
              cascade = CascadeType.PERSIST
      )
focal_class.original_string: @OneToMany(
              mappedBy = "manager",
              cascade = CascadeType.PERSIST
      )
      List<HierarchyTreeNode> directStaff;
focal_class.type: List<HierarchyTreeNode>
focal_class.var_name: directStaff
focal_class.declarator: staff
focal_class.modifier: @ManyToMany
      @JoinTable(
              name = "HIERARCHY_TREE_NODE_ALL_STAFF",
              joinColumns = @JoinColumn(name = "MANAGER_NODE_ID"),
              inverseJoinColumns = @JoinColumn(name = "NODE_ID")
      )
focal_class.original_string: @ManyToMany
      @JoinTable(
              name = "HIERARCHY_TREE_NODE_ALL_STAFF",
              joinColumns = @JoinColumn(name = "MANAGER_NODE_ID"),
              inverseJoinColumns = @JoinColumn(name = "NODE_ID")
      )
      List<HierarchyTreeNode> staff;
focal_class.type: List<HierarchyTreeNode>
focal_class.var_name: staff
focal_class.declarator: user
focal_class.modifier: @OneToOne(optional = false)
      @JoinColumn(name = "USER_ID")
focal_class.original_string: @OneToOne(optional = false)
      @JoinColumn(name = "USER_ID")
      User user;
focal_class.type: User
focal_class.var_name: user
focal_class.declarator: managingUser
focal_class.modifier: @Column(name = "IS_MANAGING_USER")
focal_class.original_string: @Column(name = "IS_MANAGING_USER")
      boolean managingUser;
focal_class.type: boolean
focal_class.var_name: managingUser
focal_class.file: backend/project-board/src/main/java/de/adesso/projectboard/base/user/persistence/hierarchy/HierarchyTreeNode.java
focal_class.identifier: HierarchyTreeNode
focal_class.interfaces: implements Iterable<HierarchyTreeNode>, Streamable<HierarchyTreeNode>, Serializable
focal_class.class_method_signature: HierarchyTreeNode.HierarchyTreeNode(User user)
focal_class.full_signature: public  HierarchyTreeNode(User user)
focal_class.identifier: HierarchyTreeNode
focal_class.modifiers: public
focal_class.parameters: (User user)
focal_class.signature:  HierarchyTreeNode(User user)
focal_class.class_method_signature: HierarchyTreeNode.isLeaf()
focal_class.full_signature: public boolean isLeaf()
focal_class.identifier: isLeaf
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isLeaf()
focal_class.class_method_signature: HierarchyTreeNode.isRoot()
focal_class.full_signature: public boolean isRoot()
focal_class.identifier: isRoot
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isRoot()
focal_class.class_method_signature: HierarchyTreeNode.getRoot()
focal_class.full_signature: public HierarchyTreeNode getRoot()
focal_class.identifier: getRoot
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: HierarchyTreeNode
focal_class.signature: HierarchyTreeNode getRoot()
focal_class.class_method_signature: HierarchyTreeNode.addDirectStaffMember(HierarchyTreeNode staffNode)
focal_class.full_signature: public void addDirectStaffMember(HierarchyTreeNode staffNode)
focal_class.identifier: addDirectStaffMember
focal_class.modifiers: public
focal_class.parameters: (HierarchyTreeNode staffNode)
focal_class.return: void
focal_class.signature: void addDirectStaffMember(HierarchyTreeNode staffNode)
focal_class.class_method_signature: HierarchyTreeNode.addStaffMember(HierarchyTreeNode staffNode)
focal_class.full_signature:  void addStaffMember(HierarchyTreeNode staffNode)
focal_class.identifier: addStaffMember
focal_class.parameters: (HierarchyTreeNode staffNode)
focal_class.return: void
focal_class.signature: void addStaffMember(HierarchyTreeNode staffNode)
focal_class.class_method_signature: HierarchyTreeNode.removeDirectStaffMember(HierarchyTreeNode staffNode)
focal_class.full_signature: public void removeDirectStaffMember(HierarchyTreeNode staffNode)
focal_class.identifier: removeDirectStaffMember
focal_class.modifiers: public
focal_class.parameters: (HierarchyTreeNode staffNode)
focal_class.return: void
focal_class.signature: void removeDirectStaffMember(HierarchyTreeNode staffNode)
focal_class.class_method_signature: HierarchyTreeNode.removeStaffMember(HierarchyTreeNode staffNode)
focal_class.full_signature:  void removeStaffMember(HierarchyTreeNode staffNode)
focal_class.identifier: removeStaffMember
focal_class.parameters: (HierarchyTreeNode staffNode)
focal_class.return: void
focal_class.signature: void removeStaffMember(HierarchyTreeNode staffNode)
focal_class.class_method_signature: HierarchyTreeNode.updateIsManagingUser()
focal_class.full_signature:  void updateIsManagingUser()
focal_class.identifier: updateIsManagingUser
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void updateIsManagingUser()
focal_class.class_method_signature: HierarchyTreeNode.managersEqual(HierarchyTreeNode other)
focal_class.full_signature:  boolean managersEqual(HierarchyTreeNode other)
focal_class.identifier: managersEqual
focal_class.parameters: (HierarchyTreeNode other)
focal_class.return: boolean
focal_class.signature: boolean managersEqual(HierarchyTreeNode other)
focal_class.class_method_signature: HierarchyTreeNode.iterator()
focal_class.full_signature: @Override public Iterator<HierarchyTreeNode> iterator()
focal_class.identifier: iterator
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Iterator<HierarchyTreeNode>
focal_class.signature: Iterator<HierarchyTreeNode> iterator()
focal_class.class_method_signature: HierarchyTreeNode.equals(Object obj)
focal_class.full_signature: @Override public boolean equals(Object obj)
focal_class.identifier: equals
focal_class.modifiers: @Override public
focal_class.parameters: (Object obj)
focal_class.return: boolean
focal_class.signature: boolean equals(Object obj)
focal_class.class_method_signature: HierarchyTreeNode.hashCode()
focal_class.full_signature: @Override public int hashCode()
focal_class.identifier: hashCode
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int hashCode()
focal_method.body: public void addDirectStaffMember(HierarchyTreeNode staffNode) {
          Objects.requireNonNull(staffNode);
  
          if(!staffNode.isRoot()) {
              staffNode.manager.removeDirectStaffMember(staffNode);
          }
  
          directStaff.add(staffNode);
          staffNode.manager = this;
  
          updateIsManagingUser();
          addStaffMember(staffNode);
      }
focal_method.class_method_signature: HierarchyTreeNode.addDirectStaffMember(HierarchyTreeNode staffNode)
focal_method.full_signature: public void addDirectStaffMember(HierarchyTreeNode staffNode)
focal_method.identifier: addDirectStaffMember
focal_method.invocations: requireNonNull isRoot removeDirectStaffMember add updateIsManagingUser addStaffMember
focal_method.modifiers: public
focal_method.parameters: (HierarchyTreeNode staffNode)
focal_method.return: void
focal_method.signature: void addDirectStaffMember(HierarchyTreeNode staffNode)