Scenario sc = new Scenario();
MockWorkingMemory wm = new MockWorkingMemory();
ScenarioRunner run = new ScenarioRunner( sc,
null,
wm );
TimeMachine tm = run.workingMemory.getTimeMachine();
// love you
long time = tm.getNow().getTimeInMillis();
Thread.sleep( 100 );
long future = tm.getNow().getTimeInMillis();
assertTrue( future > time );
ExecutionTrace ext = new ExecutionTrace();
ext.scenarioSimulatedDate = new Date( "10-Jul-1974" );
sc.fixtures.add( ext );
run = new ScenarioRunner( sc,
null,
wm );
tm = run.workingMemory.getTimeMachine();
long expected = ext.scenarioSimulatedDate.getTime();
assertEquals( expected,
tm.getNow().getTimeInMillis() );
Thread.sleep( 50 );
assertEquals( expected,
tm.getNow().getTimeInMillis() );
}