com.r3corda.node.internal.testing / MockNetwork / <init>

# <init>

`MockNetwork(threadPerNode: Boolean = false, defaultFactory: Factory = MockNetwork.DefaultFactory)`

A mock node brings up a suite of in-memory services in a fast manner suitable for unit testing. Components that do IO are either swapped out for mocks, or pointed to a Jimfs in memory filesystem.

Mock network nodes require manual pumping by default: they will not run asynchronous. This means that for message exchanges to take place (and associated handlers to run), you must call the runNetwork method.

You can get a printout of every message sent by using code like:

BriefLogFormatter.initVerbose("+messaging")