18
18
import java .time .Duration ;
19
19
import java .time .LocalDate ;
20
20
import java .time .Month ;
21
+ import java .time .ZoneId ;
21
22
import java .util .regex .Matcher ;
22
23
import java .util .regex .Pattern ;
23
24
@@ -41,7 +42,7 @@ public static void main(String... args) throws IOException, InterruptedException
41
42
42
43
}
43
44
44
- static void cleanCodeAndTestAndInputForDay (int year , int day ) throws IOException , InterruptedException {
45
+ static void cleanCodeAndTestAndInputForDay (int year , int day ) throws IOException {
45
46
String basePackageName = String .format ("adventofcode%d" , year );
46
47
String packageName = String .format ("day%02d" , day );
47
48
@@ -106,7 +107,7 @@ static void prepareCookie() throws IOException {
106
107
}
107
108
108
109
109
- static void prepareTestsForDay (int year , int day ) throws IOException , InterruptedException {
110
+ static void prepareTestsForDay (int year , int day ) throws IOException {
110
111
String basePackageName = String .format ("adventofcode%d" , year );
111
112
String packageName = String .format ("day%02d" , day );
112
113
String testClassName = String .format ("Day%02dTest" , day );
@@ -135,7 +136,7 @@ static void prepareTestsForDay(int year, int day) throws IOException, Interrupte
135
136
136
137
}
137
138
138
- static void prepareCodeForDay (int year , int day ) throws IOException , InterruptedException {
139
+ static void prepareCodeForDay (int year , int day ) throws IOException {
139
140
String basePackageName = String .format ("adventofcode%d" , year );
140
141
String packageName = String .format ("day%02d" , day );
141
142
String className = String .format ("Day%02d" , day );
@@ -182,10 +183,13 @@ static void downloadDayInput(int year, int day) throws IOException, InterruptedE
182
183
}
183
184
184
185
static int getCurrentDay () {
185
- LocalDate now = LocalDate .now ();
186
+ LocalDate now = LocalDate .now (ZoneId . of ( "America/New_York" ) );
186
187
if (now .getMonth () != Month .DECEMBER ) {
187
188
throw new IllegalArgumentException ("It is still not December." );
188
189
}
190
+ if (now .getDayOfMonth () > 25 ) {
191
+ throw new IllegalArgumentException ("No more exercises after the 25th." );
192
+ }
189
193
190
194
return now .getDayOfMonth ();
191
195
}
0 commit comments