io.contract_testing.contractcase.definitions.mocks.functions.WillCallFunction Maven / Gradle / Ivy
Show all versions of definitions Show documentation
package io.contract_testing.contractcase.definitions.mocks.functions;
/**
* Defines an example that expects a function to be called with specific arguments.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-10-02T11:15:21.465Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Jsii(module = io.contract_testing.contractcase.definitions.$Module.class, fqn = "@contract-case/case-definition-dsl.mocks.functions.WillCallFunction")
public class WillCallFunction extends io.contract_testing.contractcase.definitions.mocks.base.AnyMockDescriptor {
protected WillCallFunction(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected WillCallFunction(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param example This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public WillCallFunction(final @org.jetbrains.annotations.NotNull io.contract_testing.contractcase.definitions.mocks.functions.FunctionExecutionExample example) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(example, "example is required") });
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public @org.jetbrains.annotations.NotNull java.lang.String getFunctionName() {
return software.amazon.jsii.Kernel.get(this, "functionName", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public @org.jetbrains.annotations.NotNull java.lang.Object getRequest() {
return software.amazon.jsii.Kernel.get(this, "request", software.amazon.jsii.NativeType.forClass(java.lang.Object.class));
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public @org.jetbrains.annotations.NotNull java.lang.Object getResponse() {
return software.amazon.jsii.Kernel.get(this, "response", software.amazon.jsii.NativeType.forClass(java.lang.Object.class));
}
/**
* A fluent builder for {@link io.contract_testing.contractcase.definitions.mocks.functions.WillCallFunction}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
/**
* @return a new instance of {@link Builder}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static Builder create() {
return new Builder();
}
private final io.contract_testing.contractcase.definitions.mocks.functions.FunctionExecutionExample.Builder example;
private Builder() {
this.example = new io.contract_testing.contractcase.definitions.mocks.functions.FunctionExecutionExample.Builder();
}
/**
* An array of expected function arguments (or test equivalence matchers for those arguments).
*
* @return {@code this}
* @param arguments An array of expected function arguments (or test equivalence matchers for those arguments). This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder arguments(final java.util.List extends java.lang.Object> arguments) {
this.example.arguments(arguments);
return this;
}
/**
* The name of the function to be executed.
*
* Doubles as the handle used by
* registerFunction.
*
* @return {@code this}
* @param functionName The name of the function to be executed. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder functionName(final java.lang.String functionName) {
this.example.functionName(functionName);
return this;
}
/**
* A test equivalence matcher for the return value from this function.
*
* @return {@code this}
* @param returnValue A test equivalence matcher for the return value from this function. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder returnValue(final java.lang.Object returnValue) {
this.example.returnValue(returnValue);
return this;
}
/**
* @return a newly built instance of {@link io.contract_testing.contractcase.definitions.mocks.functions.WillCallFunction}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public io.contract_testing.contractcase.definitions.mocks.functions.WillCallFunction build() {
return new io.contract_testing.contractcase.definitions.mocks.functions.WillCallFunction(
this.example.build()
);
}
}
}