77import com .cronutils .model .definition .CronDefinitionBuilder ;
88import com .cronutils .model .time .ExecutionTime ;
99import org .junit .Assert ;
10- import org .junit .Ignore ;
1110import org .junit .Test ;
11+ import org .slf4j .Logger ;
12+ import org .slf4j .LoggerFactory ;
1213
1314import java .time .*;
1415import java .util .Optional ;
2122
2223
2324public class Issue446Test {
25+ private static final Logger LOGGER = LoggerFactory .getLogger (Issue446Test .class );
2426 private static final CronDefinition definition = CronDefinitionBuilder .defineCron ()
2527 .withMinutes ().and ()
2628 .withHours ().and ()
@@ -38,7 +40,7 @@ public void testWrongIntervalsForEvery6Months() {
3840 LocalDateTime dayOfApril = LocalDateTime .of (2020 , 4 , 25 , 0 , 0 );
3941 Clock clock = Clock .fixed (dayOfApril .toInstant (ZoneOffset .UTC ), ZoneId .systemDefault ());
4042 ZonedDateTime dayOfAprilInLocalTimezone = ZonedDateTime .now (clock );
41- System . out . println ("now: " + dayOfAprilInLocalTimezone );
43+ LOGGER . info ("now: " + dayOfAprilInLocalTimezone );
4244 Cron cron = getEveryMonthFromNow (dayOfAprilInLocalTimezone , 6 ).instance ();
4345
4446 ZonedDateTime nextRun = nextRun (cron , dayOfAprilInLocalTimezone ); // first run
@@ -69,7 +71,7 @@ public void testDaylightSavingOverlapMinuteNextRun() {
6971 LocalDateTime daylightSaving2020 = LocalDateTime .of (2020 , 10 , 25 , 1 , 10 );
7072 Clock clock = Clock .fixed (daylightSaving2020 .toInstant (ZoneOffset .ofHours (2 )),ZoneId .of ("Europe/Rome" ));
7173 ZonedDateTime daylightSaving2020InLocalTimezone = ZonedDateTime .now (clock );
72- System . out . println ("\n now: " + daylightSaving2020InLocalTimezone );
74+ LOGGER . info ("\n now: " + daylightSaving2020InLocalTimezone );
7375 Cron cron = getEvery30Minute (daylightSaving2020InLocalTimezone ).instance ();
7476
7577 ZonedDateTime nextRun = nextRun (cron , daylightSaving2020InLocalTimezone ); // first run
@@ -101,13 +103,11 @@ public void testDaylightSavingOverlapMinuteNextRun() {
101103 }
102104
103105 @ Test
104- @ Ignore
105106 public void testDaylightSavingOverlapHourNextRun () {
106-
107107 LocalDateTime startDay = LocalDateTime .of (2020 , 10 , 24 , 1 , 0 ); // Day before Daylight saving
108- Clock clock = Clock .fixed (startDay .toInstant (ZoneOffset .ofHours (2 )),ZoneId .of ("Europe/Rome" ));
108+ Clock clock = Clock .fixed (startDay .toInstant (ZoneOffset .ofHours (2 )), ZoneId .of ("Europe/Rome" ));
109109 ZonedDateTime daylightSaving2020InLocalTimezone = ZonedDateTime .now (clock );
110- System . out . println ("\n now: " + daylightSaving2020InLocalTimezone );
110+ LOGGER . info ("\n now: " + daylightSaving2020InLocalTimezone );
111111 Cron cron = getEveryHour (daylightSaving2020InLocalTimezone ).instance ();
112112
113113 ZonedDateTime nextRun = nextRun (cron , daylightSaving2020InLocalTimezone );
@@ -120,9 +120,9 @@ public void testDaylightSavingOverlapHourNextRun() {
120120 Assert .assertEquals (ZoneOffset .ofHours (2 ), nextRun .getOffset ());
121121
122122 startDay = LocalDateTime .of (2020 , 10 , 25 , 1 , 0 ); // Daylight saving
123- clock = Clock .fixed (startDay .toInstant (ZoneOffset .ofHours (2 )),ZoneId .of ("Europe/Rome" ));
123+ clock = Clock .fixed (startDay .toInstant (ZoneOffset .ofHours (2 )), ZoneId .of ("Europe/Rome" ));
124124 daylightSaving2020InLocalTimezone = ZonedDateTime .now (clock );
125- System . out . println ("\n now: " + daylightSaving2020InLocalTimezone );
125+ LOGGER . info ("\n now: " + daylightSaving2020InLocalTimezone );
126126 cron = getEveryHour (daylightSaving2020InLocalTimezone ).instance ();
127127
128128 nextRun = nextRun (cron , daylightSaving2020InLocalTimezone ); // first run
@@ -167,7 +167,7 @@ private static ZonedDateTime nextRun(Cron cron, ZonedDateTime when) {
167167 if (!next .isPresent ()) {
168168 fail ();
169169 }
170- System . out . println ("Calculated next run at " + next .get ());
170+ LOGGER . info ("Calculated next run at " + next .get ());
171171 return next .get ();
172172 }
173173}
0 commit comments