Minor: Unit testing: don't always require a lambda when running the network synchronously.

This commit is contained in:
Mike Hearn 2016-02-17 15:39:18 +01:00
parent 40d9b7686b
commit f92455442d

View File

@ -48,9 +48,13 @@ open class TestWithInMemoryNetwork {
// Keep calling "pump" in rounds until every node in the network reports that it had nothing to do
fun <T> runNetwork(body: () -> T): T {
val result = body()
while (pumpAll(false).any { it }) {}
runNetwork()
return result
}
fun runNetwork() {
while (pumpAll(false).any { it }) {}
}
}
class InMemoryMessagingTests : TestWithInMemoryNetwork() {