HierarchyTreeNode implements Iterable<HierarchyTreeNode>, Streamable<HierarchyTreeNode>, Serializable { public boolean isRoot() { return Objects.isNull(manager); } HierarchyTreeNode(User user); boolean isLeaf(); boolean isRoot(); HierarchyTreeNode getRoot(); void addDirectStaffMember(HierarchyTreeNode staffNode); void removeDirectStaffMember(HierarchyTreeNode staffNode); @Override Iterator<HierarchyTreeNode> iterator(); @Override boolean equals(Object obj); @Override int hashCode();  }
@Test public void isRootReturnsTrueWhenNodeIsItsOwnManager() { var node = new HierarchyTreeNode(userMock); assertThat(node.isRoot()).isTrue(); }
@Test public void isRootReturnsFalseWhenOtherNodeIsManager() { var managerNode = new HierarchyTreeNode(otherUserMock); var node = new HierarchyTreeNode(userMock); node.manager = managerNode; assertThat(node.isRoot()).isFalse(); }