OnlineUtils { public static boolean isSafe(Collection<SecurityIndex> securityIndexes) { Objects.requireNonNull(securityIndexes, "security indexes collection is null"); for (SecurityIndex index : securityIndexes) { if (!index.isOk()) { return false; } } return true; } private  OnlineUtils(); static Collection<Contingency> filterContingencies(List<Contingency> contingencies, List<String> contingenciesIds); static Set<String> getContingencyIds(List<Contingency> contingencies); static boolean isSafe(Collection<SecurityIndex> securityIndexes); static String getPostContingencyId(String stateId, String contingencyId); static UnitEnum getUnit(LimitViolationType type); static DateTime toCetDate(DateTime date); static LinkedHashMap<String, Double> getBranchesData(Network network);  }
@Test public void isSafeTest() { SecurityIndex securityIndex1 = Mockito.mock(SecurityIndex.class); Mockito.when(securityIndex1.isOk()).thenReturn(true); SecurityIndex securityIndex2 = Mockito.mock(SecurityIndex.class); Mockito.when(securityIndex2.isOk()).thenReturn(false); assertTrue(OnlineUtils.isSafe(Collections.emptyList())); assertTrue(OnlineUtils.isSafe(Collections.singletonList(securityIndex1))); assertTrue(OnlineUtils.isSafe(Arrays.asList(securityIndex1, securityIndex1))); assertFalse(OnlineUtils.isSafe(Collections.singletonList(securityIndex2))); assertFalse(OnlineUtils.isSafe(Arrays.asList(securityIndex1, securityIndex2))); }