### Question:
CronUtils { public static List<Date> getSelfFireDateList(Date startTime, Date endTime, CronExpression cronExpression,int fireTimes) { List<Date> dateList = new ArrayList<>(); while (fireTimes > 0) { startTime = cronExpression.getNextValidTimeAfter(startTime); if (startTime.after(endTime) || startTime.equals(endTime)) { break; } dateList.add(startTime); fireTimes--; } return dateList; } private  CronUtils(); static Cron parse2Cron(String cronExpression); static CronExpression parse2CronExpression(String cronExpression); static CycleEnum getMaxCycle(Cron cron); static CycleEnum getMiniCycle(Cron cron); static CycleEnum getMaxCycle(String crontab); static List<Date> getFireDateList(Date startTime, Date endTime, CronExpression cronExpression); static List<Date> getSelfFireDateList(Date startTime, Date endTime, CronExpression cronExpression,int fireTimes); static List<Date> getSelfFireDateList(Date startTime, Date endTime, CronExpression cronExpression); static List<Date> getSelfFireDateList(Date startTime, Date endTime, String cron); static Date getExpirationTime(Date startTime, CycleEnum cycleEnum);  }### Answer:
@Test public void getSelfFireDateList() throws ParseException{ Date from = DateUtils.stringToDate("2020-01-01 00:00:00"); Date to = DateUtils.stringToDate("2020-01-31 00:00:00"); Assert.assertEquals(0, CronUtils.getSelfFireDateList(to, from, "0 0 0 * * ? ").size()); Assert.assertEquals(0, CronUtils.getSelfFireDateList(from, to, "0 0 0 * *").size()); Assert.assertEquals(29, CronUtils.getSelfFireDateList(from, to, "0 0 0 * * ? ").size()); Assert.assertEquals(30, CronUtils.getFireDateList(from, to, CronUtils.parse2CronExpression("0 0 0 * * ? ")).size()); Assert.assertEquals(5, CronUtils.getSelfFireDateList(from, to, CronUtils.parse2CronExpression("0 0 0 * * ? "), 5).size()); }