LimitViolationFilter { public static LimitViolationFilter load() { return load(PlatformConfig.defaultConfig()); } LimitViolationFilter(Set<LimitViolationType> violationTypes);  LimitViolationFilter();  LimitViolationFilter(Set<LimitViolationType> violationTypes, double minBaseVoltage);  LimitViolationFilter(Set<LimitViolationType> violationTypes, double minBaseVoltage, Set<Country> countries); static LimitViolationFilter load(); static LimitViolationFilter load(PlatformConfig platformConfig); Set<LimitViolationType> getViolationTypes(); LimitViolationFilter setViolationTypes(Set<LimitViolationType> violationTypes); double getMinBaseVoltage(); LimitViolationFilter setMinBaseVoltage(double minBaseVoltage); Set<Country> getCountries(); LimitViolationFilter setCountries(Set<Country> countries); List<LimitViolation> apply(List<LimitViolation> violations, Network network);  }
@Test public void load() throws Exception { LimitViolationFilter filter = LimitViolationFilter.load(platformConfig); assertEquals(EnumSet.of(LimitViolationType.CURRENT, LimitViolationType.LOW_VOLTAGE), filter.getViolationTypes()); assertEquals(150.0, filter.getMinBaseVoltage(), 0.0); assertEquals(EnumSet.of(Country.FR, Country.BE), filter.getCountries()); filter.setViolationTypes(EnumSet.of(LimitViolationType.HIGH_VOLTAGE)); assertEquals(EnumSet.of(LimitViolationType.HIGH_VOLTAGE), filter.getViolationTypes()); filter.setMinBaseVoltage(225.0); filter.setCountries(EnumSet.of(Country.FR)); assertEquals(EnumSet.of(Country.FR), filter.getCountries()); assertEquals(225.0, filter.getMinBaseVoltage(), 0.0); filter.setViolationTypes(null); assertEquals(LimitViolationType.values().length, filter.getViolationTypes().size()); filter.setCountries(null); assertEquals(Country.values().length, filter.getCountries().size()); try { filter.setViolationTypes(EnumSet.noneOf(LimitViolationType.class)); fail(); } catch (Exception ignored) { } try { filter.setMinBaseVoltage(-3.0); fail(); } catch (Exception ignored) { } }