Skip to content

Commit

Permalink
Merge pull request #853 from hcoles/fix-case-insensitive-feature-check
Browse files Browse the repository at this point in the history
Make check for available features case insensitive
  • Loading branch information
hcoles authored Jan 4, 2021
2 parents c0732d4 + d2254a5 commit f0c054f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ public void describeFeatures(Consumer<Feature> enabled, Consumer<Feature> disabl
public void checkRequestedFeatures() {
FeatureParser parser = new FeatureParser();
Set<String> available = this.plugins.findFeatures().stream()
.map(f -> f.provides().name())
.map(f -> f.provides().name().toUpperCase())
.collect(Collectors.toSet());

Optional<FeatureSetting> unknown = parser.parseFeatures(this.options.getFeatures()).stream()
.filter(f -> !available.contains(f.feature()))
.filter(f -> !available.contains(f.feature().toUpperCase()))
.findAny();

unknown.ifPresent(setting -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,13 @@ public void shouldErrorWhenUnkownFeatureRequested() {

}

@Test
public void shouldTreatFeaturesAsCaseInsensitive() {
this.options.setFeatures(Arrays.asList("+feNUm"));

assertThatCode( () ->this.testee.checkRequestedFeatures())
.doesNotThrowAnyException();

}

}

0 comments on commit f0c054f

Please sign in to comment.