File tree Expand file tree Collapse file tree 3 files changed +12
-6
lines changed
java/aminetti/adventofcode2024 Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 11package aminetti .adventofcode2024 .day06 ;
22
33import org .junit .jupiter .api .Test ;
4+ import org .junit .jupiter .api .condition .EnabledIf ;
45
56import java .io .IOException ;
67import java .util .List ;
1415
1516class Day06Test {
1617
17- @ Test
18+ @ Test @ EnabledIf ( "inputExists" )
1819 void actualInputPart1 () throws IOException {
1920 // given
2021 List <String > input = readLines (resourceToString ("/day06/day06_input.txt" , UTF_8 ));
@@ -42,7 +43,7 @@ void testInputPart1() throws IOException {
4243 assertThat (l , is (41L ));
4344 }
4445
45- @ Test
46+ @ Test @ EnabledIf ( "inputExists" )
4647 void actualInputPart2 () throws IOException {
4748 // given
4849 List <String > input = readLines (resourceToString ("/day06/day06_input.txt" , UTF_8 ));
@@ -72,5 +73,7 @@ void testInputPart2() throws IOException {
7273 assertThat (l , is (6L ));
7374 }
7475
75-
76+ public static boolean inputExists () {
77+ return Day06Test .class .getResource ("/dayXX/dayXX_input.txt" ) != null ;
78+ }
7679}
Original file line number Diff line number Diff line change 11package aminetti .adventofcode2024 .dayXX ;
22
33import org .junit .jupiter .api .Test ;
4+ import org .junit .jupiter .api .condition .EnabledIf ;
45
56import java .io .IOException ;
67import java .util .List ;
1314
1415class DayXXTest {
1516
16- @ Test
17+ @ Test @ EnabledIf ( "inputExists" )
1718 void actualInputPart1 () throws IOException {
1819 // given
1920 List <String > input = readLines (resourceToString ("/dayXX/dayXX_input.txt" , UTF_8 ));
@@ -41,7 +42,7 @@ void testInputPart1() throws IOException {
4142 assertThat (l , is (0L ));
4243 }
4344
44- @ Test
45+ @ Test @ EnabledIf ( "inputExists" )
4546 void actualInputPart2 () throws IOException {
4647 // given
4748 List <String > input = readLines (resourceToString ("/dayXX/dayXX_input.txt" , UTF_8 ));
@@ -69,5 +70,7 @@ void testInputPart2() throws IOException {
6970 assertThat (l , is (0L ));
7071 }
7172
72-
73+ public static boolean inputExists () {
74+ return DayXXTest .class .getResource ("/dayXX/dayXX_input.txt" ) != null ;
75+ }
7376}
You can’t perform that action at this time.
0 commit comments