computationWithArgs
Adds a mock computation with arguments that provides computed results for the specified contract during testing.
This method creates a mock transformer that provides computation results when other transformers request computation with arguments through the specified contract. The result is provided by the lambda function which is called each time the computation is requested with arguments.
Note: Currently the arguments are not passed to the data lambda function due to the mock implementation. This will be improved in future versions.
Return
This TransmissionTest instance for method chaining
Example usage:
transformer.test()
.computationWithArgs(SearchService.searchUsersContract) {
listOf(User("john", "john@example.com"))
}
.testSignal(SearchSignal.SearchUsers("john")) { /* assertions */}Parameters
The computation contract type
The computation contract to mock
Lambda function that provides the computation result
Type Parameters
The type of data returned by the computation
The type of arguments passed to the computation