Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mathbagu authored and mathbagu committed Oct 21, 2016
1 parent 4309431 commit 7b9651c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
*/
package eu.itesla_project.modules.constraints;

import java.util.Collections;
import java.util.EnumSet;
import java.util.Objects;
import java.util.Set;

import eu.itesla_project.commons.config.ModuleConfig;
Expand All @@ -24,7 +24,7 @@
public class ConstraintsModifierConfig {

public static final Set<LimitViolationType> DEFAULT_VIOLATION_TYPES = EnumSet.of(LimitViolationType.CURRENT);
public static final Set<Country> DEFAULT_COUNTRIES = Collections.emptySet();
public static final Set<Country> DEFAULT_COUNTRIES = EnumSet.noneOf(Country.class);

private final Set<Country> countries;
private final Set<LimitViolationType> violationsTypes;
Expand All @@ -48,8 +48,8 @@ public static ConstraintsModifierConfig load(PlatformConfig platformConfig) {
}

public ConstraintsModifierConfig(Set<Country> countries, Set<LimitViolationType> violationsTypes) {
this.countries = countries;
this.violationsTypes = violationsTypes;
this.countries = Objects.requireNonNull(countries);
this.violationsTypes = Objects.requireNonNull(violationsTypes);
}

public Set<Country> getCountries() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ public void testNoConfig() throws Exception {

@Test
public void testLoadConfig() throws Exception {
Set<Country> countries = new HashSet(Arrays.asList(Country.FR));
Set<Country> countries = EnumSet.of(Country.FR);
checkConfig(countries);
}

@Test
public void testLoadConfigMultipleCountries() throws Exception {
Set<Country> countries = new HashSet(Arrays.asList(Country.values()));
Set<Country> countries = EnumSet.allOf(Country.class);
checkConfig(countries);
}

Expand Down

0 comments on commit 7b9651c

Please sign in to comment.