Add wildcard-based class exclusion from JUnit mojo

This commit is contained in:
Alexey Andreev 2015-06-23 18:23:57 +04:00
parent e3017828d8
commit 49e6050871
2 changed files with 17 additions and 0 deletions

View File

@ -101,6 +101,9 @@
<debugInformationGenerated>true</debugInformationGenerated>
<sourceMapsGenerated>true</sourceMapsGenerated>
<sourceFilesCopied>true</sourceFilesCopied>
<excludeWildcards>
<wildcard>**.GC*Test</wildcard>
</excludeWildcards>
</configuration>
</execution>
</executions>

View File

@ -83,6 +83,9 @@ public class BuildJavascriptTestMojo extends AbstractMojo {
@Parameter
private String[] wildcards = { "**.*Test", "**.*UnitTest" };
@Parameter
private String[] excludeWildcards = new String[0];
@Parameter
private boolean minifying = true;
@ -150,6 +153,10 @@ public class BuildJavascriptTestMojo extends AbstractMojo {
this.wildcards = wildcards;
}
public void setExcludeWildcards(String[] excludeWildcards) {
this.excludeWildcards = excludeWildcards;
}
public String[] getTransformers() {
return transformers;
}
@ -359,6 +366,13 @@ public class BuildJavascriptTestMojo extends AbstractMojo {
if (!matches) {
return;
}
for (String wildcard : excludeWildcards) {
if (FilenameUtils.wildcardMatch(simpleName, wildcard.replace('.', '/'))) {
return;
}
}
try {
Class<?> candidate = Class.forName(className, true, classLoader);
if (tool.getAdapter().acceptClass(candidate)) {