OnlineUtils { public static Set<String> getContingencyIds(List<Contingency> contingencies) { Objects.requireNonNull(contingencies, "contingencies list is null"); return contingencies.stream().map(Contingency::getId).collect(Collectors.toSet()); } 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 getContingenciesIdTest() { Set<String> contingenciesId = OnlineUtils.getContingencyIds(contingencies); assertEquals(2, contingenciesId.size()); assertTrue(contingenciesId.contains("id1")); assertTrue(contingenciesId.contains("id2")); assertFalse(contingenciesId.contains("id3")); }