remove TestableMock annotation

This commit is contained in:
金戟 2021-01-24 16:32:05 +08:00
parent f9be92e9d0
commit 650b385785
4 changed files with 1 additions and 28 deletions

View File

@ -16,7 +16,6 @@ public class ConstPool {
public static final String MOCK_WITH = "com.alibaba.testable.core.annotation.MockWith";
public static final String MOCK_METHOD = "com.alibaba.testable.core.annotation.MockMethod";
public static final String MOCK_CONSTRUCTOR = "com.alibaba.testable.core.annotation.MockConstructor";
public static final String TESTABLE_MOCK = "com.alibaba.testable.core.annotation.TestableMock";
public static final String CGLIB_CLASS_INFIX = "$$EnhancerBy";

View File

@ -119,7 +119,6 @@ public class TestClassHandler extends BaseClassHandler {
}
for (AnnotationNode an : mn.visibleAnnotations) {
if (ClassUtil.toByteCodeClassName(ConstPool.MOCK_METHOD).equals(an.desc) ||
ClassUtil.toByteCodeClassName(ConstPool.TESTABLE_MOCK).equals(an.desc) ||
ClassUtil.toByteCodeClassName(ConstPool.MOCK_CONSTRUCTOR).equals(an.desc)) {
return true;
}

View File

@ -141,8 +141,7 @@ public class TestableClassTransformer implements ClassFileTransformer {
String fullClassName = toDotSeparateFullClassName(an.desc);
if (fullClassName.equals(ConstPool.MOCK_CONSTRUCTOR)) {
addMockConstructor(methodInfos, cn, mn);
} else if (fullClassName.equals(ConstPool.MOCK_METHOD) ||
fullClassName.equals(ConstPool.TESTABLE_MOCK)) {
} else if (fullClassName.equals(ConstPool.MOCK_METHOD)) {
String targetMethod = AnnotationUtil.getAnnotationParameter(
an, ConstPool.FIELD_TARGET_METHOD, mn.name, String.class);
if (ConstPool.CONSTRUCTOR.equals(targetMethod)) {
@ -201,7 +200,6 @@ public class TestableClassTransformer implements ClassFileTransformer {
for (AnnotationNode an : mn.visibleAnnotations) {
String fullClassName = toDotSeparateFullClassName(an.desc);
if (fullClassName.equals(ConstPool.MOCK_METHOD) ||
fullClassName.equals(ConstPool.TESTABLE_MOCK) ||
fullClassName.equals(ConstPool.MOCK_CONSTRUCTOR)) {
return true;
}

View File

@ -1,23 +0,0 @@
package com.alibaba.testable.core.annotation;
import java.lang.annotation.*;
/**
* Mark method as mock method
* @deprecated will be remove in v0.5.0, use @MockMethod or @MockConstructor instead
*
* @author flin
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Documented
@Deprecated
public @interface TestableMock {
/**
* mock specified method instead of method with same name
* @return target method name
*/
String targetMethod() default "";
}