withData

Adds a mock data holder that provides data for the specified contract during testing.

This method creates a mock transformer that provides data when other transformers query the specified data holder contract. The data is provided by the lambda function which is called each time the contract is queried.

Return

This TransmissionTest instance for method chaining

Example usage:

transformer.test()
.withData(UserRepository.currentUserContract) {
UserData.LoggedIn(User("test_user", "test@example.com"))
}
.testSignal(ProfileSignal.Load) { /* assertions */}

Parameters

D

The type of data provided by the contract

contract

The data holder contract to mock

data

Lambda function that provides the data when queried