DepartmentUtil { public static long getDeptTreeSize(List<SysDeptTree> sysDeptTreeList) { if (sysDeptTreeList == null) { return 0; } long size = 0; for (SysDeptTree sysDeptTree : sysDeptTreeList) { size += 1 + getDeptTreeSize(sysDeptTree.getChildren()); } return size; }  static void disableTargetDeptCode(List<SysDeptSelect> sysDeptSelects,
                                          String deptCode); static List<SysDeptTree> wrapDeptListToTree(List<SysDept> sysDeptList,
                                                     List<SysDeptSelect> sysDeptSelects); static long getDeptTreeSize(List<SysDeptTree> sysDeptTreeList);  }
@Test public void getDeptTreeSizeTest() { List<SysDeptTree> sysDeptTreeList = DepartmentUtil.wrapDeptListToTree(sysDeptList, sysDeptSelects); long sizeDeptTreeList = DepartmentUtil.getDeptTreeSize(sysDeptTreeList); assertEquals(sizeDeptTreeList, 5); }