@Test
public void apply() throws Exception {

    Network network = TestingNetworkFactory.create();
    LimitViolation line1Violation = new LimitViolation("LINE1", LimitViolationType.CURRENT, "", Integer.MAX_VALUE, 1000.0, 1, 1100.0, Branch.Side.ONE);
    LimitViolation line2Violation = new LimitViolation("LINE2", LimitViolationType.CURRENT, "", Integer.MAX_VALUE, 900.0, 1, 950.0, Branch.Side.TWO);
    LimitViolation vl1Violation = new LimitViolation("VL1", LimitViolationType.HIGH_VOLTAGE, 200.0, 1, 250.0);
    LimitViolationFilter filter = new LimitViolationFilter();
    List<LimitViolation> filteredViolations = filter.apply(Arrays.asList(line1Violation, line2Violation, vl1Violation), network);
    assertEquals(3, filteredViolations.size());
    filter = new LimitViolationFilter();
    filter.setViolationTypes(EnumSet.of(LimitViolationType.HIGH_VOLTAGE));
    filteredViolations = filter.apply(Arrays.asList(line1Violation, line2Violation, vl1Violation), network);
    checkFilteredViolations(filteredViolations, network, "VL1", LimitViolationType.HIGH_VOLTAGE, 220.0, Country.FR, "VL1");
    filter = new LimitViolationFilter();
    filter.setMinBaseVoltage(300.0);
    filteredViolations = filter.apply(Arrays.asList(line1Violation, line2Violation, vl1Violation), network);
    checkFilteredViolations(filteredViolations, network, "LINE1", LimitViolationType.CURRENT, 380.0, Country.FR, "VL2");
    filter = new LimitViolationFilter();
    filter.setCountries(EnumSet.of(Country.BE));
    filteredViolations = filter.apply(Arrays.asList(line1Violation, line2Violation, vl1Violation), network);
    checkFilteredViolations(filteredViolations, network, "LINE2", LimitViolationType.CURRENT, 220.0, Country.BE, "VL3");
    filter = new LimitViolationFilter(EnumSet.of(LimitViolationType.CURRENT), 300.0, EnumSet.of(Country.FR));
    filteredViolations = filter.apply(Arrays.asList(line1Violation, line2Violation, vl1Violation), network);
    checkFilteredViolations(filteredViolations, network, "LINE1", LimitViolationType.CURRENT, 380.0, Country.FR, "VL2");
}