From d3ab246c781454a93ddb3d3ca2596c53df2f089c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=87=91=E6=88=9F?= Date: Mon, 31 May 2021 23:36:53 +0800 Subject: [PATCH] should travel parent classes --- .../alibaba/testable/agent/transformer/MockClassParser.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testable-agent/src/main/java/com/alibaba/testable/agent/transformer/MockClassParser.java b/testable-agent/src/main/java/com/alibaba/testable/agent/transformer/MockClassParser.java index 75717d5..f5a3782 100644 --- a/testable-agent/src/main/java/com/alibaba/testable/agent/transformer/MockClassParser.java +++ b/testable-agent/src/main/java/com/alibaba/testable/agent/transformer/MockClassParser.java @@ -21,6 +21,7 @@ import static com.alibaba.testable.agent.constant.ConstPool.KOTLIN_POSTFIX_COMPA import static com.alibaba.testable.agent.util.ClassUtil.toJavaStyleClassName; import static com.alibaba.testable.agent.util.MethodUtil.isStatic; import static com.alibaba.testable.core.constant.ConstPool.CONSTRUCTOR; +import static com.alibaba.testable.core.constant.ConstPool.MOCK_POSTFIX; public class MockClassParser { @@ -52,7 +53,7 @@ public class MockClassParser { return false; } DiagnoseUtil.setupByClass(cn); - for (MethodNode mn : cn.methods) { + for (MethodNode mn : cn.name.endsWith(MOCK_POSTFIX) ? getAllMethods(cn) : cn.methods) { if (mn.visibleAnnotations != null) { for (AnnotationNode an : mn.visibleAnnotations) { String fullClassName = toJavaStyleClassName(an.desc);