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:
Mike Hearn
2016-05-13 15:37:07 +02:00
committed by Mike Hearn
parent 8bcc6bdf1c
commit f9920cbc28
4 changed files with 58 additions and 22 deletions

View 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)
}
}
}