增加定时任务提醒单元测试
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
d03f990461
commit
bf17724cb5
@ -0,0 +1,33 @@
|
||||
package java.com.ruoyi.web.controller.system;
|
||||
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.quartz.task.ScheduledRemindersTask;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Slf4j
|
||||
@SpringBootTest
|
||||
class ScheduledRemindersTaskJobTest {
|
||||
@Autowired
|
||||
private ScheduledRemindersTask scheduledRemindersTask;
|
||||
|
||||
@Test
|
||||
void execute() {
|
||||
LocalDateTime startDate = LocalDateTime.of(2023, 9, 6, 0, 0);
|
||||
LocalDateTime endDate = LocalDateTime.of(2023, 9, 6, 22, 30);
|
||||
while (startDate.isBefore(endDate) || startDate.isBefore(endDate)){
|
||||
try {
|
||||
System.out.println( DateUtils.ldt2str(startDate, DateUtils.YYYY_MM_DD_HH_MM_SS));
|
||||
scheduledRemindersTask.scheduledRemindersTemporarily(startDate);
|
||||
}catch (Exception e) {
|
||||
log.error("ScheduledRemindersTaskJobTest execute time:{}", DateUtils.ldt2str(startDate, DateUtils.YYYY_MM_DD_HH_MM_SS), e);
|
||||
}finally {
|
||||
startDate = startDate.plusMinutes(15L);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue