mirror of
https://github.com/corda/corda.git
synced 2025-06-20 08:03:53 +00:00
Testing: expose a future from the Simulation.start method to let you find out when the simulation has finished (if it finishes at all).
Add a simple test that just forces the IRS simulation through to completion (no real checks on the output).
This commit is contained in:
23
src/test/kotlin/core/testing/IRSSimulationTest.kt
Normal file
23
src/test/kotlin/core/testing/IRSSimulationTest.kt
Normal file
@ -0,0 +1,23 @@
|
||||
package core.testing
|
||||
|
||||
import com.google.common.base.Throwables
|
||||
import core.utilities.BriefLogFormatter
|
||||
import org.junit.Test
|
||||
|
||||
/**
|
||||
* This test doesn't check anything except that the simulation finishes and there are no exceptions at any point.
|
||||
* The details of the IRS contract are verified in other unit tests.
|
||||
*/
|
||||
class IRSSimulationTest {
|
||||
@Test fun `runs to completion`() {
|
||||
BriefLogFormatter.initVerbose("messaging")
|
||||
val sim = IRSSimulation(false, null)
|
||||
val future = sim.start()
|
||||
while (!future.isDone) sim.iterate()
|
||||
try {
|
||||
future.get()
|
||||
} catch(e: Throwable) {
|
||||
throw Throwables.getRootCause(e)
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user