package com.xjrsoft.module.job;

import com.xjrsoft.XjrSoftApplication;
import com.xjrsoft.common.utils.DateUtils;
import com.xjrsoft.module.holiday.service.IHolidayDateService;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.Calendar;
import java.util.Date;

import static org.junit.jupiter.api.Assertions.*;

/**
 * @author dzx
 * @date 2024/5/31
 */
@RunWith(SpringRunner.class)
@SpringBootTest(classes = XjrSoftApplication.class)
class HolidayTaskTest {

    @Autowired
    private IHolidayDateService holidayDateService;
    @Test
    public void RefreshHoliday() {
        System.out.printf("定时拉取节假日数据：%s", DateUtils.format(new Date(), DateUtils.DATE_TIME_PATTERN));
        Date date = new Date();
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);

        holidayDateService.initHoliday(calendar.get(Calendar.YEAR));
    }
}