@Test
public void validationTestForDL() {

    Network network = DanglingLineNetworkFactory.create();
    Contingency danglingLineContingency = new Contingency("DL contingency", new DanglingLineContingency("DL"));
    Contingency danglingLineInvalidContingency = new Contingency("DL invalid contingency", new DanglingLineContingency("DL_THAT_DO_NOT_EXIST"));
    List<Contingency> validContingencies = Contingency.checkValidity(Arrays.asList(danglingLineContingency, danglingLineInvalidContingency), network);
    assertEquals(Arrays.asList("DL contingency"),
            validContingencies.stream().map(Contingency::getId).collect(Collectors.toList()));
}