Skip to content

Commit

Permalink
Made the code more resistant to legacy tag provider strategies.
Browse files Browse the repository at this point in the history
The code should not crash if an old tag provider is used (e.g. an older version of Cucumber), but should revert to the old tag priorities.
  • Loading branch information
wakaleo committed Sep 30, 2016
1 parent ab47980 commit a5d5a6e
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,21 @@ protected Iterable<? extends TagProvider> loadTagProvidersFromPath(String testSo

private Iterable<? extends TagProvider> tagProvidersWithHighPriority(Iterable<TagProviderStrategy> tagProviderStrategies) {
for (TagProviderStrategy strategy : tagProviderStrategies) {
if (strategy.hasHighPriority()) {
if (isHighPriority(strategy)) {
return strategy.getTagProviders();
}
}
return null;
}

private boolean isHighPriority(TagProviderStrategy strategy) {
try {
return strategy.hasHighPriority();
} catch(AbstractMethodError usingAnOldAPI) {
return false;
}
}

private Iterable<? extends TagProvider> tagProvidersThatCanProcess(Iterable<TagProviderStrategy> tagProviderStrategies,String testSource) {
for (TagProviderStrategy strategy : tagProviderStrategies) {
if (strategy.canHandleTestSource(testSource)) {
Expand Down

0 comments on commit a5d5a6e

Please sign in to comment.