1818import java .time .Duration ;
1919import java .time .LocalDate ;
2020import java .time .Month ;
21+ import java .time .ZoneId ;
2122import java .util .regex .Matcher ;
2223import java .util .regex .Pattern ;
2324
@@ -41,7 +42,7 @@ public static void main(String... args) throws IOException, InterruptedException
4142
4243 }
4344
44- static void cleanCodeAndTestAndInputForDay (int year , int day ) throws IOException , InterruptedException {
45+ static void cleanCodeAndTestAndInputForDay (int year , int day ) throws IOException {
4546 String basePackageName = String .format ("adventofcode%d" , year );
4647 String packageName = String .format ("day%02d" , day );
4748
@@ -106,7 +107,7 @@ static void prepareCookie() throws IOException {
106107 }
107108
108109
109- static void prepareTestsForDay (int year , int day ) throws IOException , InterruptedException {
110+ static void prepareTestsForDay (int year , int day ) throws IOException {
110111 String basePackageName = String .format ("adventofcode%d" , year );
111112 String packageName = String .format ("day%02d" , day );
112113 String testClassName = String .format ("Day%02dTest" , day );
@@ -135,7 +136,7 @@ static void prepareTestsForDay(int year, int day) throws IOException, Interrupte
135136
136137 }
137138
138- static void prepareCodeForDay (int year , int day ) throws IOException , InterruptedException {
139+ static void prepareCodeForDay (int year , int day ) throws IOException {
139140 String basePackageName = String .format ("adventofcode%d" , year );
140141 String packageName = String .format ("day%02d" , day );
141142 String className = String .format ("Day%02d" , day );
@@ -182,10 +183,13 @@ static void downloadDayInput(int year, int day) throws IOException, InterruptedE
182183 }
183184
184185 static int getCurrentDay () {
185- LocalDate now = LocalDate .now ();
186+ LocalDate now = LocalDate .now (ZoneId . of ( "America/New_York" ) );
186187 if (now .getMonth () != Month .DECEMBER ) {
187188 throw new IllegalArgumentException ("It is still not December." );
188189 }
190+ if (now .getDayOfMonth () > 25 ) {
191+ throw new IllegalArgumentException ("No more exercises after the 25th." );
192+ }
189193
190194 return now .getDayOfMonth ();
191195 }
0 commit comments