diff --git a/testable-agent/src/main/java/com/alibaba/testable/agent/handler/MockClassHandler.java b/testable-agent/src/main/java/com/alibaba/testable/agent/handler/MockClassHandler.java index 5a00656..e07c1e1 100644 --- a/testable-agent/src/main/java/com/alibaba/testable/agent/handler/MockClassHandler.java +++ b/testable-agent/src/main/java/com/alibaba/testable/agent/handler/MockClassHandler.java @@ -25,7 +25,7 @@ public class MockClassHandler extends BaseClassWithContextHandler { private static final String SIGNATURE_INVOKE_ORIGIN = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;"; private static final String METHOD_RECORD_MOCK_INVOKE = "recordMockInvoke"; - private static final String SIGNATURE_RECORDER_METHOD_INVOKE = "([Ljava/lang/Object;ZZ)V"; + private static final String SIGNATURE_RECORDER_METHOD_INVOKE = "([Ljava/lang/Object;Z)V"; private static final String METHOD_IS_ASSOCIATED = "isAssociated"; private static final String SIGNATURE_IS_ASSOCIATED = "()Z"; @@ -188,7 +188,6 @@ public class MockClassHandler extends BaseClassWithContextHandler { } else { il.add(new InsnNode(ICONST_0)); } - il.add(new InsnNode(ICONST_1)); il.add(new MethodInsnNode(INVOKESTATIC, CLASS_INVOKE_RECORD_UTIL, METHOD_RECORD_MOCK_INVOKE, SIGNATURE_RECORDER_METHOD_INVOKE, false)); mn.instructions.insertBefore(mn.instructions.getFirst(), il); diff --git a/testable-core/src/main/java/com/alibaba/testable/core/util/InvokeRecordUtil.java b/testable-core/src/main/java/com/alibaba/testable/core/util/InvokeRecordUtil.java index 1b82827..b776c82 100644 --- a/testable-core/src/main/java/com/alibaba/testable/core/util/InvokeRecordUtil.java +++ b/testable-core/src/main/java/com/alibaba/testable/core/util/InvokeRecordUtil.java @@ -16,9 +16,8 @@ public class InvokeRecordUtil { * Record mock method invoke event * @param args invocation parameters * @param isConstructor whether mocked method is constructor - * @param isTargetClassInParameter whether use first parameter as target class */ - public static void recordMockInvoke(Object[] args, boolean isConstructor, boolean isTargetClassInParameter) { + public static void recordMockInvoke(Object[] args, boolean isConstructor) { StackTraceElement mockMethodTraceElement = Thread.currentThread().getStackTrace()[INDEX_OF_TEST_CLASS]; String mockMethodName = mockMethodTraceElement.getMethodName(); MockContext mockContext = MockContextUtil.context.get(); @@ -32,7 +31,7 @@ public class InvokeRecordUtil { mockContext.invokeRecord.get(mockMethodName).add(args); LogUtil.verbose(" Mock constructor \"%s\" invoked in %s::%s", mockMethodName, testClass, testCaseName); } else { - mockContext.invokeRecord.get(mockMethodName).add(isTargetClassInParameter ? slice(args, 1) : args); + mockContext.invokeRecord.get(mockMethodName).add(slice(args, 1)); LogUtil.verbose(" Mock method \"%s\" invoked in %s::%s\"", mockMethodName, testClass, testCaseName); } }