### Question:
DependentUtils { public static DependResult getDependResultForRelation(DependentRelation relation, List<DependResult> dependResultList) { DependResult dependResult = DependResult.SUCCESS; switch (relation) { case AND: if (dependResultList.contains(DependResult.FAILED)) { dependResult = DependResult.FAILED; } if (dependResultList.contains(DependResult.WAITING)) { dependResult = DependResult.WAITING; } break; case OR: if (dependResultList.contains(DependResult.SUCCESS)) { dependResult = DependResult.SUCCESS; } else if (dependResultList.contains(DependResult.WAITING)) { dependResult = DependResult.WAITING; } else { dependResult = DependResult.FAILED; } break; default: break; } return dependResult; } private  DependentUtils(); static DependResult getDependResultForRelation(DependentRelation relation,
                                                          List<DependResult> dependResultList); static List<DateInterval> getDateIntervalList(Date businessDate, String dateValue);  }### Answer:
@Test public void getDependResultForRelation() { DependentRelation dependentRelation = DependentRelation.AND; List<DependResult> dependResultList = new ArrayList<>(); dependResultList.add(DependResult.FAILED); dependResultList.add(DependResult.SUCCESS); DependResult result = DependentUtils.getDependResultForRelation(dependentRelation, dependResultList); Assert.assertEquals(result, DependResult.FAILED); dependResultList = new ArrayList<>(); dependResultList.add(DependResult.WAITING); dependResultList.add(DependResult.SUCCESS); result = DependentUtils.getDependResultForRelation(dependentRelation, dependResultList); Assert.assertEquals(result, DependResult.WAITING); dependResultList = new ArrayList<>(); dependResultList.add(DependResult.SUCCESS); dependResultList.add(DependResult.SUCCESS); result = DependentUtils.getDependResultForRelation(dependentRelation, dependResultList); Assert.assertEquals(result, DependResult.SUCCESS); dependResultList = new ArrayList<>(); dependResultList.add(DependResult.SUCCESS); result = DependentUtils.getDependResultForRelation(dependentRelation, dependResultList); Assert.assertEquals(result, DependResult.SUCCESS); dependResultList = new ArrayList<>(); dependResultList.add(DependResult.FAILED); result = DependentUtils.getDependResultForRelation(dependentRelation, dependResultList); Assert.assertEquals(result, DependResult.FAILED); dependentRelation = DependentRelation.OR; dependResultList = new ArrayList<>(); dependResultList.add(DependResult.FAILED); dependResultList.add(DependResult.SUCCESS); result = DependentUtils.getDependResultForRelation(dependentRelation, dependResultList); Assert.assertEquals(result, DependResult.SUCCESS); dependResultList = new ArrayList<>(); dependResultList.add(DependResult.WAITING); dependResultList.add(DependResult.FAILED); result = DependentUtils.getDependResultForRelation(dependentRelation, dependResultList); Assert.assertEquals(result, DependResult.WAITING); dependResultList = new ArrayList<>(); dependResultList.add(DependResult.SUCCESS); dependResultList.add(DependResult.SUCCESS); result = DependentUtils.getDependResultForRelation(dependentRelation, dependResultList); Assert.assertEquals(result, DependResult.SUCCESS); dependResultList = new ArrayList<>(); dependResultList.add(DependResult.SUCCESS); result = DependentUtils.getDependResultForRelation(dependentRelation, dependResultList); Assert.assertEquals(result, DependResult.SUCCESS); dependResultList = new ArrayList<>(); dependResultList.add(DependResult.FAILED); result = DependentUtils.getDependResultForRelation(dependentRelation, dependResultList); Assert.assertEquals(result, DependResult.FAILED); }