add method

This commit is contained in:
Looly
2022-10-26 10:54:56 +08:00
parent 6064586ef9
commit c79cdc1f6f
17 changed files with 131 additions and 103 deletions

View File

@@ -14,7 +14,7 @@ public class CronPatternNextMatchTest {
public void nextMatchAllAfterTest() {
// 匹配所有,返回下一秒的时间
CronPattern pattern = new CronPattern("* * * * * * *");
DateTime date = DateUtil.truncate(DateUtil.date(), DateField.SECOND);
DateTime date = DateUtil.truncate(DateUtil.now(), DateField.SECOND);
Calendar calendar = pattern.nextMatchAfter(date.toCalendar());
Assert.assertEquals(date.getTime(), DateUtil.date(calendar).getTime());

View File

@@ -30,7 +30,7 @@ public class CronPatternTest {
pattern = CronPattern.of("* * * * *");
// 测试时,秒归零,则任意时间匹配
assertMatch(pattern, DateUtil.beginOfMinute(DateUtil.date()).toString());
assertMatch(pattern, DateUtil.beginOfMinute(DateUtil.now()).toString());
}
@Test