File tree Expand file tree Collapse file tree 3 files changed +57
-26
lines changed
main/java/org/junit/vintage/engine
test/java/org/junit/vintage/engine/execution Expand file tree Collapse file tree 3 files changed +57
-26
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2015-2025 the original author or authors.
3+ *
4+ * All rights reserved. This program and the accompanying materials are
5+ * made available under the terms of the Eclipse Public License v2.0 which
6+ * accompanies this distribution and is available at
7+ *
8+ * https://www.eclipse.org/legal/epl-v20.html
9+ */
10+
11+ package org .junit .vintage .engine ;
12+
13+ import static org .apiguardian .api .API .Status .EXPERIMENTAL ;
14+ import static org .apiguardian .api .API .Status .STABLE ;
15+
16+ import org .apiguardian .api .API ;
17+
18+ /**
19+ * Collection of constants related to the {@link VintageTestEngine}.
20+ *
21+ * @since 5.12
22+ */
23+ @ API (status = STABLE , since = "5.12" )
24+ public final class Constants {
25+
26+ /**
27+ * Indicates whether parallel execution is enabled for the JUnit Vintage engine.
28+ *
29+ * <p>Set this property to {@code true} to enable parallel execution of tests.
30+ * Defaults to {@code false}.
31+ *
32+ * @since 5.12
33+ */
34+ @ API (status = EXPERIMENTAL , since = "5.12" )
35+ public static final String PARALLEL_EXECUTION_ENABLED = "junit.vintage.execution.parallel.enabled" ;
36+
37+ /**
38+ * Specifies the size of the thread pool to be used for parallel execution.
39+ *
40+ * <p>Set this property to an integer value to specify the number of threads
41+ * to be used for parallel execution. Defaults to the number of available
42+ * processors.
43+ *
44+ * @since 5.12
45+ */
46+ @ API (status = EXPERIMENTAL , since = "5.12" )
47+ public static final String PARALLEL_POOL_SIZE = "junit.vintage.execution.parallel.pool-size" ;
48+
49+ private Constants () {
50+ /* no-op */
51+ }
52+
53+ }
Original file line number Diff line number Diff line change 1212
1313import static org .apiguardian .api .API .Status .INTERNAL ;
1414import static org .junit .platform .engine .TestExecutionResult .successful ;
15+ import static org .junit .vintage .engine .Constants .PARALLEL_EXECUTION_ENABLED ;
16+ import static org .junit .vintage .engine .Constants .PARALLEL_POOL_SIZE ;
1517import static org .junit .vintage .engine .descriptor .VintageTestDescriptor .ENGINE_ID ;
1618
1719import java .util .ArrayList ;
@@ -52,29 +54,6 @@ public final class VintageTestEngine implements TestEngine {
5254 private static final int DEFAULT_THREAD_POOL_SIZE = Runtime .getRuntime ().availableProcessors ();
5355 private static final int SHUTDOWN_TIMEOUT_SECONDS = 30 ;
5456
55- /**
56- * Indicates whether parallel execution is enabled for the JUnit Vintage engine.
57- *
58- * <p>Set this property to {@code true} to enable parallel execution of tests.
59- * Defaults to {@code false}.
60- *
61- * @since 5.12
62- */
63- @ API (status = INTERNAL , since = "5.12" )
64- public static final String PARALLEL_EXECUTION_ENABLED = "junit.vintage.execution.parallel.enabled" ;
65-
66- /**
67- * Specifies the size of the thread pool to be used for parallel execution.
68- *
69- * <p>Set this property to an integer value to specify the number of threads
70- * to be used for parallel execution. Defaults to the number of available
71- * processors.
72- *
73- * @since 5.12
74- */
75- @ API (status = INTERNAL , since = "5.12" )
76- public static final String PARALLEL_POOL_SIZE = "junit.vintage.execution.parallel.pool-size" ;
77-
7857 @ Override
7958 public String getId () {
8059 return ENGINE_ID ;
Original file line number Diff line number Diff line change 1515import static org .junit .platform .testkit .engine .EventConditions .event ;
1616import static org .junit .platform .testkit .engine .EventConditions .finishedSuccessfully ;
1717import static org .junit .platform .testkit .engine .EventConditions .started ;
18+ import static org .junit .vintage .engine .Constants .PARALLEL_EXECUTION_ENABLED ;
19+ import static org .junit .vintage .engine .Constants .PARALLEL_POOL_SIZE ;
1820import static org .junit .vintage .engine .descriptor .VintageTestDescriptor .SEGMENT_TYPE_RUNNER ;
1921import static org .junit .vintage .engine .samples .junit4 .JUnit4ParallelTestCase .AbstractBlockingTestCase ;
2022import static org .junit .vintage .engine .samples .junit4 .JUnit4ParallelTestCase .FirstTestCase ;
4244
4345class ParallelExecutionIntegrationTests {
4446
45- private static final String PARALLEL_EXECUTION_ENABLED = "junit.vintage.execution.parallel.enabled" ;
46- private static final String PARALLEL_POOL_SIZE = "junit.vintage.execution.parallel.pool-size" ;
47-
4847 @ Test
4948 void executesTestClassesInParallel (TestReporter reporter ) {
5049 AbstractBlockingTestCase .threadNames .clear ();
You can’t perform that action at this time.
0 commit comments