mirror of
https://github.com/alibaba/testable-mock.git
synced 2025-01-24 11:20:26 +08:00
package prefix should auto append dot
This commit is contained in:
parent
0c063e9b1f
commit
d10478f95f
@ -32,7 +32,7 @@
|
||||
|
||||
```xml
|
||||
<configuration>
|
||||
<argLine>-javaagent:${settings.localRepository}/com/alibaba/testable/testable-agent/${testable.version}/testable-agent-${testable.version}.jar=mockScope=associated&pkgPrefix=com.demo.</argLine>
|
||||
<argLine>-javaagent:${settings.localRepository}/com/alibaba/testable/testable-agent/${testable.version}/testable-agent-${testable.version}.jar=mockScope=associated&pkgPrefix=com.demo</argLine>
|
||||
</configuration>
|
||||
```
|
||||
|
||||
@ -42,5 +42,5 @@
|
||||
|
||||
|
||||
```groovy
|
||||
jvmArgs "-javaagent:${classpath.find { it.name.contains("testable-agent") }.absolutePath}=mockScope=associated&pkgPrefix=com.demo."
|
||||
jvmArgs "-javaagent:${classpath.find { it.name.contains("testable-agent") }.absolutePath}=mockScope=associated&pkgPrefix=com.demo"
|
||||
```
|
||||
|
@ -33,7 +33,7 @@ public class ArgumentParser {
|
||||
} else if (k.equals(DUMP_PATH)) {
|
||||
GlobalConfig.setDumpPath(v);
|
||||
} else if (k.equals(PKG_PREFIX)) {
|
||||
GlobalConfig.setPkgPrefix(v);
|
||||
GlobalConfig.setPkgPrefixes(v);
|
||||
} else if (k.equals(MOCK_SCOPE)) {
|
||||
GlobalConfig.setDefaultMockScope(MockScope.of(v));
|
||||
} else if (k.equals(CONFIG_FILE)) {
|
||||
|
@ -57,7 +57,7 @@ public class PropertiesParser {
|
||||
} else if (k.equals(DUMP_PATH)) {
|
||||
GlobalConfig.setDumpPath(v);
|
||||
} else if (k.equals(PKG_PREFIX_WHITELIST)) {
|
||||
GlobalConfig.setPkgPrefix(v);
|
||||
GlobalConfig.setPkgPrefixes(v);
|
||||
} else if (k.equals(DEFAULT_MOCK_SCOPE)) {
|
||||
GlobalConfig.setDefaultMockScope(MockScope.of(v));
|
||||
} else if (k.equals(ENABLE_THREAD_POOL)) {
|
||||
|
@ -141,9 +141,9 @@ public class TestableClassTransformer implements ClassFileTransformer {
|
||||
if (null == className || className.contains(CGLIB_CLASS_PATTERN)) {
|
||||
return true;
|
||||
}
|
||||
String whitePrefix = GlobalConfig.getPkgPrefix();
|
||||
if (whitePrefix != null) {
|
||||
for (String prefix : whitePrefix.split(COMMA)) {
|
||||
List<String> whitePrefixes = GlobalConfig.getPkgPrefixes();
|
||||
if (!whitePrefixes.isEmpty()) {
|
||||
for (String prefix : whitePrefixes) {
|
||||
if (className.startsWith(prefix)) {
|
||||
// Only consider package in provided list as non-system class
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user