DepartmentUtil { public static void disableTargetDeptCode(List<SysDeptSelect> sysDeptSelects, String deptCode) { if (sysDeptSelects == null) { return; } for (SysDeptSelect deptSelect : sysDeptSelects) { if (deptSelect.getKey().equalsIgnoreCase(deptCode)) { deptSelect.setDisabled(true); } disableTargetDeptCode(deptSelect.getChildren(), deptCode); } }  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 disableTargetDeptCodeTest() { DepartmentUtil.disableTargetDeptCode(sysDeptSelects, "AAA"); assertEquals(sysDeptSelects.get(0).getChildren().get(0).getChildren().get(0).getDisabled(), Boolean.TRUE); }