Reputation: 23140
I have a CorDapp where I define an oracle. The oracle works fine when running the nodes normally. However, when running flow tests using a MockNetwork, I get the following exception:
net.corda.core.flows.FlowException: java.lang.IllegalArgumentException: Corda service net.corda.option.oracle.oracle.Oracle does not exist
How can I register the Corda service with the MockNetwork
or get it to recognise it?
Upvotes: 0
Views: 409
Reputation: 23140
When initialising the MockNetwork
, you must pass the package where the service is defined as one of the CorDapp packages to scan. So in your case, you would write:
private val mockNet: MockNetwork = MockNetwork(
cordappPackages = listOf("net.corda.option.oracle.oracle")
)
Upvotes: 2