Class MockInvocationHandler.Stubbing
java.lang.Object
cloud.opencode.base.test.mock.MockInvocationHandler.Stubbing
- Enclosing class:
MockInvocationHandler
Stubbing configuration.
存根配置。
- Since:
- JDK 25, opencode-base-test V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
-
Method Summary
Modifier and TypeMethodDescriptionthenAnswer(Function<Object[], Object> answer) Answers with function.Calls real method (for partial mocks).thenReturn(Object value) Returns specified value.Throws specified exception.
-
Method Details
-
thenReturn
Returns specified value. 返回指定值。- Parameters:
value- the value to return | 要返回的值- Returns:
- this | 此对象
-
thenThrow
Throws specified exception. 抛出指定异常。- Parameters:
throwable- the exception to throw | 要抛出的异常- Returns:
- this | 此对象
-
thenAnswer
Answers with function. 使用函数应答。- Parameters:
answer- the answer function | 应答函数- Returns:
- this | 此对象
-
thenCallRealMethod
Calls real method (for partial mocks). 调用真实方法(部分Mock)。- Returns:
- this | 此对象
-