Testing with client wrappers

To test your CordApps using the generated client wrappers, you can create a test network using the Web3j Corda network DSL.

Before that, make sure you have the required test dependencies to your project.

// Initialise the test network
val myNetwork = network {
    directory = File("<path-to-corDapp>")
    nodes {
        notary {
            name = "O=Notary, L=London, C=GB"
        }
        party {
            name = "O=PartyA, L=London, C=GB"
        }
        party {
            name = "O=PartyB, L=New York, C=US"
        }
    }
}

By using the wrappers generated by the web3j-corda command, one can interact with a CorDapp in a type-safe way:

// Initialise the parameters of the flow 
val params = YoFlowPayload(partyB)

// Start the flow with typed parameters and response
val output = Yo.load(myNetwork.parties[0].corda.service).flows.yoFlow.start(params)