cancel
Showing results for 
Search instead for 
Did you mean: 

How do i Unit test TimerBoundaryEvent?

potgieterde
Champ in-the-making
Champ in-the-making
Hi,

I`m a bit lost around JUnit testing a TimerBoundaryEvent? Any ideas on how to stop/wait/pause/alter date to be able to test this?

I read somewhere about
activitiRule.setCurrentTime(new Date((new Date().getTime()+1000*60*5)));

But how do i set this half way through my unit test?

Thanks
Derick
1 REPLY 1

frederikherema1
Star Contributor
Star Contributor
Altering date that activiti uses can be done using the class org.activiti.engine.impl.util.ClockUtil.

But you still need to wait until the job-executor has finished processing the timer-job, after changing the current time. Take a look at the method waitForJobExecutorToProcessAllJobs on src.main.java.org.activiti.engine.impl.test.AbstractActivitiTestCase, for a safe way to do this…