跳到主要内容

无存根时失败

DeepSeek V3 中英对照 Fail On No Stubs

默认情况下,如果未找到存根,Stub Runner 将失败。要更改此行为,请在注解中将 failOnNoStubs 属性设置为 false,或在 JUnit Rule 或 Extension 上调用 withFailOnNoStubs(false) 方法。以下示例展示了如何操作:

@AutoConfigureStubRunner(
stubsMode = StubRunnerProperties.StubsMode.REMOTE,
repositoryRoot = "stubs://file://location/to/the/contracts",
ids = "com.example:some-producer",
failOnNoStubs = false)
@Rule
public StubRunnerRule rule = new StubRunnerRule()
.downloadStub("com.example:some-producer")
.repoRoot("stubs://file://location/to/the/contracts")
.stubsMode(StubRunnerProperties.StubsMode.REMOTE)
.withFailOnNoStubs(false);
@RegisterExtension
public StubRunnerExtension stubRunnerExtension = new StubRunnerExtension()
.downloadStub("com.example:some-producer")
.repoRoot("stubs://file://location/to/the/contracts")
.stubsMode(StubRunnerProperties.StubsMode.REMOTE)
.withFailOnNoStubs(false);