Class MockInvocationHandler.Stubbing

java.lang.Object
cloud.opencode.base.test.mock.MockInvocationHandler.Stubbing
Enclosing class:
MockInvocationHandler

public static class MockInvocationHandler.Stubbing extends Object
Stubbing configuration. 存根配置。
Since:
JDK 25, opencode-base-test V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Method Details

    • thenReturn

      public MockInvocationHandler.Stubbing thenReturn(Object value)
      Returns specified value. 返回指定值。
      Parameters:
      value - the value to return | 要返回的值
      Returns:
      this | 此对象
    • thenThrow

      public MockInvocationHandler.Stubbing thenThrow(Throwable throwable)
      Throws specified exception. 抛出指定异常。
      Parameters:
      throwable - the exception to throw | 要抛出的异常
      Returns:
      this | 此对象
    • thenAnswer

      public MockInvocationHandler.Stubbing thenAnswer(Function<Object[],Object> answer)
      Answers with function. 使用函数应答。
      Parameters:
      answer - the answer function | 应答函数
      Returns:
      this | 此对象
    • thenCallRealMethod

      public MockInvocationHandler.Stubbing thenCallRealMethod()
      Calls real method (for partial mocks). 调用真实方法(部分Mock)。
      Returns:
      this | 此对象