mirror of
https://github.com/alibaba/testable-mock.git
synced 2025-03-23 16:20:26 +08:00
green light the demo package
This commit is contained in:
parent
dad2ea3a76
commit
0ae39d9deb
@ -35,9 +35,10 @@ public class TestableClassTransformer implements ClassFileTransformer {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Just avoid spend time to scan those surely non-user classes
|
* 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/" };
|
"org/apache/maven/", "com/alibaba/testable/", "junit/", "org/junit/", "org/testng/" };
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -82,7 +83,12 @@ public class TestableClassTransformer implements ClassFileTransformer {
|
|||||||
if (null == className) {
|
if (null == className) {
|
||||||
return true;
|
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)) {
|
if (className.startsWith(prefix)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<relativePath>../testable-parent</relativePath>
|
<relativePath>../testable-parent</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>testable-all</artifactId>
|
<artifactId>testable-all</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>testable-all</name>
|
<name>testable-all</name>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
Loading…
Reference in New Issue
Block a user