green light the demo package

This commit is contained in:
金戟 2020-12-10 20:02:23 +08:00
parent dad2ea3a76
commit 0ae39d9deb
2 changed files with 10 additions and 4 deletions

View File

@ -35,9 +35,10 @@ public class TestableClassTransformer implements ClassFileTransformer {
/**
* Just avoid spend time to scan those surely non-user classes
* Should keep this list as tiny as possible
* Should keep these lists as tiny as possible
*/
private final String[] SYSTEM_PREFIXES = new String[] { "jdk/", "java/", "javax/", "com/sun/",
private final String[] WHITELIST_PREFIXES = new String[] { "com/alibaba/testable/demo/" };
private final String[] BLACKLIST_PREFIXES = new String[] { "jdk/", "java/", "javax/", "com/sun/",
"org/apache/maven/", "com/alibaba/testable/", "junit/", "org/junit/", "org/testng/" };
@Override
@ -82,7 +83,12 @@ public class TestableClassTransformer implements ClassFileTransformer {
if (null == className) {
return true;
}
for (String prefix : SYSTEM_PREFIXES) {
for (String prefix : WHITELIST_PREFIXES) {
if (className.startsWith(prefix)) {
return false;
}
}
for (String prefix : BLACKLIST_PREFIXES) {
if (className.startsWith(prefix)) {
return true;
}

View File

@ -10,7 +10,7 @@
<relativePath>../testable-parent</relativePath>
</parent>
<artifactId>testable-all</artifactId>
<packaging>pom</packaging>
<packaging>jar</packaging>
<name>testable-all</name>
<dependencies>