Testing Quartz CronTrigger trigger

前端 未结 6 1859
北荒
北荒 2020-12-30 06:04

Assuming that I have a CronTriggerBean similar to



        
6条回答
  •  死守一世寂寞
    2020-12-30 06:10

    Well firstly, there's no point in testing CronTriggerBean itself. It's part of the spring framework, and has already been tested.

    A better test might be to test that your cron expression is what you expect. One option here is to use Quartz's CronExpression class. Given a CronExpression object, you can call getNextValidTimeAfter(Date), which returns the next time after the given Date when the expression will fire.

提交回复
热议问题