mirror of
https://github.com/alibaba/testable-mock.git
synced 2025-01-10 20:30:11 +08:00
add mock method scope
This commit is contained in:
parent
c364e96f77
commit
6d6e2ecb7f
@ -1,5 +1,7 @@
|
||||
package com.alibaba.testable.core.annotation;
|
||||
|
||||
import com.alibaba.testable.core.model.MockScope;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
@ -11,4 +13,11 @@ import java.lang.annotation.*;
|
||||
@Target(ElementType.METHOD)
|
||||
@Documented
|
||||
public @interface MockConstructor {
|
||||
|
||||
/**
|
||||
* specify the effective scope of the mock method
|
||||
* @return global or associated
|
||||
*/
|
||||
MockScope scope() default MockScope.ASSOCIATED;
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.alibaba.testable.core.annotation;
|
||||
|
||||
import com.alibaba.testable.core.model.MockScope;
|
||||
|
||||
import javax.lang.model.type.NullType;
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@ -25,4 +27,10 @@ public @interface MockMethod {
|
||||
*/
|
||||
Class<?> targetClass() default NullType.class;
|
||||
|
||||
/**
|
||||
* specify the effective scope of the mock method
|
||||
* @return global or associated
|
||||
*/
|
||||
MockScope scope() default MockScope.ASSOCIATED;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
package com.alibaba.testable.core.model;
|
||||
|
||||
public enum MockScope {
|
||||
|
||||
/**
|
||||
* Mock method only available for test cases in the test class it belongs to
|
||||
*/
|
||||
ASSOCIATED,
|
||||
|
||||
/**
|
||||
* Mock method available for any test cases
|
||||
*/
|
||||
GLOBAL
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user