Class OpenMock.Verification<T>

java.lang.Object
cloud.opencode.base.test.OpenMock.Verification<T>
Type Parameters:
T - the mock type | mock类型
Enclosing class:
OpenMock

public static class OpenMock.Verification<T> extends Object
Verification wrapper for asserting mock invocations 用于断言mock调用的验证包装器
Since:
JDK 25, opencode-base-test V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Method Details

    • wasInvoked

      public OpenMock.Verification<T> wasInvoked(String methodName)
      Verifies method was invoked 验证方法被调用
      Parameters:
      methodName - the method name | 方法名
      Returns:
      this verification | 此验证
    • wasInvoked

      public OpenMock.Verification<T> wasInvoked(String methodName, int times)
      Verifies method was invoked exactly N times 验证方法被调用恰好N次
      Parameters:
      methodName - the method name | 方法名
      times - the expected times | 期望次数
      Returns:
      this verification | 此验证
    • wasNeverInvoked

      public OpenMock.Verification<T> wasNeverInvoked(String methodName)
      Verifies method was never invoked 验证方法从未被调用
      Parameters:
      methodName - the method name | 方法名
      Returns:
      this verification | 此验证
    • invocationCount

      public int invocationCount(String methodName)
      Gets the invocation count for a method 获取方法的调用次数
      Parameters:
      methodName - the method name | 方法名
      Returns:
      the count | 次数
    • getAllInvocations

      public List<OpenMock.Invocation> getAllInvocations()
      Gets all invocations 获取所有调用
      Returns:
      the invocations | 调用列表