11
11
import java .util .Arrays ;
12
12
import java .util .Collection ;
13
13
import java .util .Collections ;
14
+ import java .util .HashSet ;
14
15
import java .util .List ;
16
+ import java .util .Set ;
15
17
import java .util .concurrent .TimeUnit ;
16
18
import java .util .regex .Pattern ;
17
19
import java .util .stream .Collectors ;
22
24
public class MavenTest {
23
25
24
26
// Define the timeout for each test
25
- private static final Duration TEST_TIMEOUT = Duration .ofSeconds (10 );
27
+ private static final Duration TEST_TIMEOUT = Duration .ofSeconds (5 );
26
28
27
29
// Regex pattern to match "p" followed by only digits
28
30
private static final Pattern PROBLEM_DIR_PATTERN = Pattern .compile ("p\\ d+" );
29
31
32
+ // Define a skip list for problems to exclude
33
+ private static final Set <String > SKIP_PROBLEMS = new HashSet <>(Arrays .asList (
34
+ "p10009" // Add problems to skip here
35
+ ));
36
+
30
37
// Method to dynamically discover problem names
31
38
private static List <String > discoverProblemNames () {
32
39
String basePackagePath = "com/lzw/solutions/uva/" ;
@@ -71,8 +78,11 @@ public boolean accept(File current, String name) {
71
78
return Collections .emptyList ();
72
79
}
73
80
74
- List <String > problems =
75
- Arrays .stream (problemDirs ).map (File ::getName ).sorted ().collect (Collectors .toList ());
81
+ List <String > problems = Arrays .stream (problemDirs )
82
+ .map (File ::getName )
83
+ .filter (name -> !SKIP_PROBLEMS .contains (name )) // Filter out skipped problems
84
+ .sorted ()
85
+ .collect (Collectors .toList ());
76
86
77
87
// Read maxproblems system property
78
88
String maxProblemsStr = System .getProperty ("maxproblems" );
@@ -91,7 +101,7 @@ public boolean accept(File current, String name) {
91
101
}
92
102
}
93
103
94
- System .out .println ("Discovered problems: " + problems );
104
+ System .out .println ("Discovered problems (after skipping) : " + problems );
95
105
return problems ;
96
106
}
97
107
@@ -175,5 +185,4 @@ Collection<DynamicTest> runMavenExecTests() {
175
185
}))
176
186
.collect (Collectors .toList ());
177
187
}
178
-
179
188
}
0 commit comments