Cleanup languages to skip

This commit is contained in:
Clément Fournier
2020-11-24 11:39:59 +01:00
parent 86b5948f07
commit 21506cea85
2 changed files with 7 additions and 9 deletions

View File

@@ -60,22 +60,20 @@ public abstract class AbstractRuleSetFactoryTest {
private static SAXParser saxParser;
protected Set<String> validXPathClassNames = new HashSet<>();
private Set<Language> languagesToSkip = new HashSet<>();
private final Set<String> languagesToSkip = new HashSet<>();
public AbstractRuleSetFactoryTest() {
this(null);
this(new String[0]);
}
/**
* Constructor used when a module that depends on another module wants to filter out the dependee's rulesets.
*
* @param languagesToSkip {@link Language}s that appear in the classpath via a dependency, but should be
* @param languagesToSkip {@link Language}s terse names that appear in the classpath via a dependency, but should be
* skipped because they aren't the primary language which the concrete instance of this class is testing.
*/
public AbstractRuleSetFactoryTest(Language... languagesToSkip) {
if (languagesToSkip != null) {
this.languagesToSkip.addAll(Arrays.asList(languagesToSkip));
}
public AbstractRuleSetFactoryTest(String... languagesToSkip) {
this.languagesToSkip.addAll(Arrays.asList(languagesToSkip));
validXPathClassNames.add(XPathRule.class.getName());
}
@@ -278,7 +276,7 @@ public abstract class AbstractRuleSetFactoryTest {
List<String> result = new ArrayList<>();
for (Language language : LanguageRegistry.getLanguages()) {
if (this.languagesToSkip.contains(language)) {
if (this.languagesToSkip.contains(language.getTerseName())) {
continue;
}
result.addAll(getRuleSetFileNames(language.getTerseName()));

View File

@@ -9,6 +9,6 @@ import net.sourceforge.pmd.lang.apex.ApexLanguageModule;
public class RuleSetFactoryTest extends AbstractRuleSetFactoryTest {
public RuleSetFactoryTest() {
super(new ApexLanguageModule());
super(ApexLanguageModule.TERSE_NAME);
}
}