1 package org.kuali.ole.batch;
2
3 import org.junit.Test;
4 import org.kuali.ole.deliver.service.OleBatchJobService;
5 import org.kuali.ole.sys.exception.ParseException;
6 import org.quartz.CronExpression;
7
8 import java.util.Date;
9
10 import static junit.framework.TestCase.assertNotNull;
11 import static junit.framework.TestCase.assertNull;
12
13
14
15
16 public class CronExpression_UT {
17
18 @Test
19 public void expressionTestForFutureDate() throws java.text.ParseException {
20 String expression = "0 10 21 15 9 ? 2025";
21 Date nextValidTimeToRunJobFromCronExpression = OleBatchJobService.getNextValidTimeToRunJobFromCronExpression(expression);
22 assertNotNull(nextValidTimeToRunJobFromCronExpression);
23 System.out.println(nextValidTimeToRunJobFromCronExpression);
24 }
25
26 @Test
27 public void expressionTestForPastDate() throws java.text.ParseException {
28 String expression = "0 10 21 15 9 ? 2010";
29 Date nextValidTimeToRunJobFromCronExpression = OleBatchJobService.getNextValidTimeToRunJobFromCronExpression(expression);
30 assertNull(nextValidTimeToRunJobFromCronExpression);
31 }
32 }