File tree 3 files changed +12
-6
lines changed
java/aminetti/adventofcode2024
3 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 1
1
package aminetti .adventofcode2024 .day06 ;
2
2
3
3
import org .junit .jupiter .api .Test ;
4
+ import org .junit .jupiter .api .condition .EnabledIf ;
4
5
5
6
import java .io .IOException ;
6
7
import java .util .List ;
14
15
15
16
class Day06Test {
16
17
17
- @ Test
18
+ @ Test @ EnabledIf ( "inputExists" )
18
19
void actualInputPart1 () throws IOException {
19
20
// given
20
21
List <String > input = readLines (resourceToString ("/day06/day06_input.txt" , UTF_8 ));
@@ -42,7 +43,7 @@ void testInputPart1() throws IOException {
42
43
assertThat (l , is (41L ));
43
44
}
44
45
45
- @ Test
46
+ @ Test @ EnabledIf ( "inputExists" )
46
47
void actualInputPart2 () throws IOException {
47
48
// given
48
49
List <String > input = readLines (resourceToString ("/day06/day06_input.txt" , UTF_8 ));
@@ -72,5 +73,7 @@ void testInputPart2() throws IOException {
72
73
assertThat (l , is (6L ));
73
74
}
74
75
75
-
76
+ public static boolean inputExists () {
77
+ return Day06Test .class .getResource ("/dayXX/dayXX_input.txt" ) != null ;
78
+ }
76
79
}
Original file line number Diff line number Diff line change 1
1
package aminetti .adventofcode2024 .dayXX ;
2
2
3
3
import org .junit .jupiter .api .Test ;
4
+ import org .junit .jupiter .api .condition .EnabledIf ;
4
5
5
6
import java .io .IOException ;
6
7
import java .util .List ;
13
14
14
15
class DayXXTest {
15
16
16
- @ Test
17
+ @ Test @ EnabledIf ( "inputExists" )
17
18
void actualInputPart1 () throws IOException {
18
19
// given
19
20
List <String > input = readLines (resourceToString ("/dayXX/dayXX_input.txt" , UTF_8 ));
@@ -41,7 +42,7 @@ void testInputPart1() throws IOException {
41
42
assertThat (l , is (0L ));
42
43
}
43
44
44
- @ Test
45
+ @ Test @ EnabledIf ( "inputExists" )
45
46
void actualInputPart2 () throws IOException {
46
47
// given
47
48
List <String > input = readLines (resourceToString ("/dayXX/dayXX_input.txt" , UTF_8 ));
@@ -69,5 +70,7 @@ void testInputPart2() throws IOException {
69
70
assertThat (l , is (0L ));
70
71
}
71
72
72
-
73
+ public static boolean inputExists () {
74
+ return DayXXTest .class .getResource ("/dayXX/dayXX_input.txt" ) != null ;
75
+ }
73
76
}
You can’t perform that action at this time.
0 commit comments