Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
827df2b
Setup project skeleton
mpkorstanje Jul 30, 2026
ed2e1ee
Enable annotation processor for ConfigurationParameter
mpkorstanje Jul 30, 2026
14ffed5
Output minimal junit-platform-configuration-metadata.json
mpkorstanje Jul 30, 2026
63dd21b
Fix workaround for Javadoc
mpkorstanje Jul 30, 2026
578bdca
Fix verifyOSGi
mpkorstanje Jul 30, 2026
2d7547d
Fix describe module tests
mpkorstanje Jul 30, 2026
6bc410b
Fix allPublicTopLevelTypesHaveApiAnnotations test
mpkorstanje Jul 30, 2026
e06d4c1
Explain why processing linting is supressed
mpkorstanje Jul 30, 2026
ccea87e
Output junit-platform-configuration-metadata for platform-launcher
mpkorstanje Jul 30, 2026
fd1baf1
Fix checkBackwardCompatibility
mpkorstanje Jul 30, 2026
3295a99
Fix JarDescribeModuleTests
mpkorstanje Jul 30, 2026
3b5624f
Reduce scope to compileOnly
mpkorstanje Jul 31, 2026
314e8fd
Process annotations for Vintage
mpkorstanje Jul 31, 2026
a3aa4e5
Setup minimal unit test
mpkorstanje Aug 3, 2026
b155836
Add Eclipse IDE compatibility note
mpkorstanje Aug 4, 2026
149556b
Extract TestCompiler
mpkorstanje Aug 4, 2026
72d715b
Write output with platform independent newline
mpkorstanje Aug 4, 2026
c1789d6
Require annotated fields to be static with a constant value string
mpkorstanje Aug 4, 2026
9a1f897
Add Property.sourceType
mpkorstanje Aug 4, 2026
7c3df1f
Add deprecation and refactor
mpkorstanje Aug 4, 2026
d764e3f
Remove redundant local variable
mpkorstanje Aug 5, 2026
3b011f7
Generate some json output
mpkorstanje Aug 5, 2026
dd5fc8c
Use jakarta.json and serialize by hand
mpkorstanje Aug 6, 2026
7e7476c
Use JSON syntax highlighting in tests
mpkorstanje Aug 6, 2026
9381ee1
Shadow jakarta.json and parsson into processor jar
marcphilipp Aug 8, 2026
3cfa463
Fix ArchUnit check
marcphilipp Aug 8, 2026
b63ef2a
Merge branch 'main' into feature/generate-configuration-parameters-ov…
marcphilipp Aug 9, 2026
94a9f04
Fix `aggregateJavadocs` task
marcphilipp Aug 9, 2026
ec4e77c
Merge branch 'main' into feature/generate-configuration-parameters-ov…
marcphilipp Aug 9, 2026
433b3b9
Drop dependency on junit-platform-commons
marcphilipp Aug 9, 2026
525aa1c
Merge metadata files for standalone jar
marcphilipp Aug 9, 2026
fa5ab92
Fail if attempting to merge non-array nodes
marcphilipp Aug 9, 2026
d708416
Extract explicit type for deprecation
mpkorstanje Aug 6, 2026
bf68047
Deprecation.Warning level can be omitted
mpkorstanje Aug 6, 2026
5b0eef0
Remove ``: {@value}`` from doc comments
mpkorstanje Aug 6, 2026
8d46a8b
Only use the first paragraph of the documentation
mpkorstanje Aug 6, 2026
b8e9230
Add note about error handling
mpkorstanje Aug 6, 2026
d6c4cc2
Process Property.type
mpkorstanje Aug 6, 2026
7cf5a6d
Rename ConfigurationProperty to ConfigurationParameter
mpkorstanje Aug 9, 2026
59e4a87
Remove ConfigurationParameter.type from scope
mpkorstanje Aug 9, 2026
1e1741f
Document minimal scope
mpkorstanje Aug 9, 2026
5d7daad
Polish deprecation element
mpkorstanje Aug 9, 2026
3a1fdb9
Implement missing json conversions
mpkorstanje Aug 9, 2026
adfc951
Remove unused Json
mpkorstanje Aug 9, 2026
53aca3c
Document ConfigurationMetaData
mpkorstanje Aug 9, 2026
ef7e949
Rename JsonWriter to JsonConverter
mpkorstanje Aug 9, 2026
64dc068
Extract AnnotationMirrorUtil
mpkorstanje Aug 9, 2026
0084a4a
Extract ConfigurationParameterHandler
mpkorstanje Aug 9, 2026
8c264aa
Reorg ConfigurationParameterHandler
mpkorstanje Aug 9, 2026
c0121e2
Add type and default value
mpkorstanje Aug 9, 2026
e4ec3df
Read type and default value from annotation
mpkorstanje Aug 9, 2026
70f6af3
Only support singular default values for now
mpkorstanje Aug 10, 2026
2493c67
Render defaults as json values where applicable
mpkorstanje Aug 10, 2026
5e6d62e
Annotate Jupiter Constants
mpkorstanje Aug 10, 2026
a235f3e
Claim ConfigurationParameter annotations
mpkorstanje Aug 10, 2026
6918e32
Extract ProcessingContext
mpkorstanje Aug 11, 2026
93c0e3a
Extract ConfigurationParameterAnnotatedField
mpkorstanje Aug 11, 2026
3a6ce7f
Replace preconditions with error message
mpkorstanje Aug 11, 2026
ae8b921
Nitpick
mpkorstanje Aug 11, 2026
dc9a43a
Documentation
mpkorstanje Aug 11, 2026
0244147
Add integration test with Maven
mpkorstanje Aug 11, 2026
98f0885
Annotate constant classes
mpkorstanje Aug 11, 2026
ff561e8
Merge branch 'main' into feature/generate-configuration-parameters-ov…
marcphilipp Aug 14, 2026
e0e8e67
Move mapping closer to source
mpkorstanje Aug 14, 2026
b9719c6
Extract defaults for Vintage Constants
mpkorstanje Aug 15, 2026
0c8f652
Extract defaults for Jupiter Constants
mpkorstanje Aug 15, 2026
a9f104a
Extract defaults for Launcher Constants
mpkorstanje Aug 15, 2026
de709d0
Document defaults for Launcher Constants
mpkorstanje Aug 15, 2026
d0dbadf
Document defaults for Vintage Constants
mpkorstanje Aug 15, 2026
d43b040
Document defaults for Jupiter Constants
mpkorstanje Aug 15, 2026
43b8a69
Reference enum values as strings
mpkorstanje Aug 15, 2026
d663d11
Remove TODO
mpkorstanje Aug 15, 2026
3fc5cfe
Document DefaultParallelExecutionConfigurationStrategy defaults
mpkorstanje Aug 15, 2026
0beb3c5
Make LauncherPhase a public but internal
mpkorstanje Aug 15, 2026
a7d1ad7
Reuse constants from org.junit.platform.engine
mpkorstanje Aug 15, 2026
fe24aa6
Give up on TimeoutDuration for now
mpkorstanje Aug 16, 2026
da22b65
Break paragraphs on first @tag.
mpkorstanje Aug 16, 2026
a19c93d
Pretty print junit-platform-configuration-metadata.json
mpkorstanje Aug 16, 2026
5ef7650
Strip @code and @link(plain) tags.
mpkorstanje Aug 17, 2026
e009920
Remove TODO.
mpkorstanje Aug 17, 2026
bb2e42d
Remove TODO.
mpkorstanje Aug 17, 2026
9428810
Polish documentation
mpkorstanje Sep 2, 2026
e764485
Document circular-ish dependency
mpkorstanje Sep 2, 2026
52ed6fa
Clean up TODOs
mpkorstanje Sep 2, 2026
cf06a6b
Merge branch 'main' into feature/generate-configuration-parameters-ov…
mpkorstanje Sep 2, 2026
5fccf19
Update Release notes
mpkorstanje Sep 2, 2026
ad9b4b1
Sketch out user guide documentation
mpkorstanje Sep 4, 2026
e023410
Extract link
mpkorstanje Sep 4, 2026
57e55c0
Sketch out more documentation
mpkorstanje Sep 9, 2026
91a64d8
Polish documentation
mpkorstanje Sep 12, 2026
9afd204
Extract more default values and add test consistency
mpkorstanje Sep 12, 2026
5e696bd
Merge remote-tracking branch 'origin/main' into feature/generate-conf…
mpkorstanje Sep 12, 2026
be8b36a
Update release notes
mpkorstanje Sep 12, 2026
688f77f
Update release notes
mpkorstanje Sep 12, 2026
5bb0670
Generate Asciidoc reference from configuration parameter metadata (#5…
marcphilipp Sep 12, 2026
4550c49
Include example generated by annotation processor
marcphilipp Sep 13, 2026
1ae68f4
Update documentation/modules/ROOT/pages/advanced-topics/junit-platfor…
mpkorstanje Sep 14, 2026
aca015c
Update documentation/modules/ROOT/nav.adoc
mpkorstanje Sep 14, 2026
9df6623
Rename junit-platform-configuration.adoc to onfiguration-parameter-do…
mpkorstanje Sep 14, 2026
747779b
Extract ExecutionMode for example
mpkorstanje Sep 14, 2026
990b117
Document new component in appendix
mpkorstanje Sep 14, 2026
a803360
Rename to ConfigurationMetadata
mpkorstanje Sep 14, 2026
572e595
Remove unused level
mpkorstanje Sep 14, 2026
4229888
Delete gradle/incremental.annotation.processors
mpkorstanje Sep 14, 2026
186c38e
Use since = "6.2"
mpkorstanje Sep 14, 2026
d110ac3
Return null for consistency
mpkorstanje Sep 14, 2026
e8ba0df
Remove redundant try-catch-rethrow
mpkorstanje Sep 14, 2026
6da8606
Update junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel…
mpkorstanje Sep 14, 2026
0d183d7
Update junit-vintage-engine/src/main/java/org/junit/vintage/engine/Co…
mpkorstanje Sep 14, 2026
74fb180
Write bytes as integer to json
mpkorstanje Sep 14, 2026
3a8c322
Reference enum values by reference rather than enumeration
mpkorstanje Sep 16, 2026
16bd405
Add configuration parameter hint and group attributes to overview
mpkorstanje Sep 12, 2026
56d30f2
Render hints
mpkorstanje Sep 13, 2026
f4c5b83
Include description with enum hint values
mpkorstanje Sep 16, 2026
18f2b0e
Use type for hints and use javadoc from enum values
mpkorstanje Sep 16, 2026
965f0c0
WIP: Support class reference hints
mpkorstanje Sep 16, 2026
ce3d54d
Merge remote-tracking branch 'origin/main' into feature/generate-conf…
mpkorstanje Sep 18, 2026
57d124a
Fix merge
mpkorstanje Sep 18, 2026
c707345
Support class reference hints
mpkorstanje Sep 18, 2026
baff412
Make Timeout.TimeoutMode part of API
mpkorstanje Sep 18, 2026
f0cad5d
Support manually provided hints
mpkorstanje Sep 18, 2026
b77beab
Document all the timeouts
mpkorstanje Sep 18, 2026
bf45128
Process the hints annotation
mpkorstanje Sep 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 103 additions & 11 deletions junit-jupiter-api/src/main/java/org/junit/jupiter/api/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import org.junit.jupiter.api.parallel.Execution;
import org.junit.jupiter.api.parallel.ExecutionMode;
import org.junit.platform.configuration.api.ConfigurationParameter;
import org.junit.platform.configuration.api.ConfigurationParameter.Hint;
import org.junit.platform.configuration.api.ConfigurationParameter.Hints;
import org.junit.platform.engine.support.hierarchical.DefaultParallelExecutionConfigurationStrategy;
import org.junit.platform.engine.support.hierarchical.ParallelExecutionConfigurationStrategy;
import org.junit.platform.engine.support.hierarchical.ParallelHierarchicalTestExecutorServiceFactory;
Expand Down Expand Up @@ -330,15 +332,33 @@ public final class Constants {
*
* @see Timeout#DEFAULT_TIMEOUT_PROPERTY_NAME
*/
@ConfigurationParameter(type = String.class)
@ConfigurationParameter(type = String.class, hints = @Hints(permitsAdditionalValues = true, value = { //
@Hint(value = "42 ", description = "A duration in seconds"), //
@Hint(value = "42 ns", description = "A duration in nanoseconds"), //
@Hint(value = "42 μs", description = "A duration in microseconds"), //
@Hint(value = "42 ms", description = "A duration in milliseconds"), //
@Hint(value = "42 s ", description = "A duration in seconds"), //
@Hint(value = "42 m ", description = "A duration in minutes"), //
@Hint(value = "42 h ", description = "A duration in hours"), //
@Hint(value = "42 d ", description = "A duration in days") //
}))
public static final String DEFAULT_TIMEOUT_PROPERTY_NAME = Timeout.DEFAULT_TIMEOUT_PROPERTY_NAME;

/**
* Property name used to set the default timeout for all testable methods: {@value}
*
* @see Timeout#DEFAULT_TESTABLE_METHOD_TIMEOUT_PROPERTY_NAME
*/
@ConfigurationParameter(type = String.class)
@ConfigurationParameter(type = String.class, hints = @Hints(permitsAdditionalValues = true, value = { //
@Hint(value = "42 ", description = "A duration in seconds"), //
@Hint(value = "42 ns", description = "A duration in nanoseconds"), //
@Hint(value = "42 μs", description = "A duration in microseconds"), //
@Hint(value = "42 ms", description = "A duration in milliseconds"), //
@Hint(value = "42 s ", description = "A duration in seconds"), //
@Hint(value = "42 m ", description = "A duration in minutes"), //
@Hint(value = "42 h ", description = "A duration in hours"), //
@Hint(value = "42 d ", description = "A duration in days") //
}))
public static final String DEFAULT_TESTABLE_METHOD_TIMEOUT_PROPERTY_NAME = Timeout.DEFAULT_TESTABLE_METHOD_TIMEOUT_PROPERTY_NAME;

/**
Expand All @@ -347,7 +367,16 @@ public final class Constants {
*
* @see Timeout#DEFAULT_TEST_METHOD_TIMEOUT_PROPERTY_NAME
*/
@ConfigurationParameter(type = String.class)
@ConfigurationParameter(type = String.class, hints = @Hints(permitsAdditionalValues = true, value = { //
@Hint(value = "42 ", description = "A duration in seconds"), //
@Hint(value = "42 ns", description = "A duration in nanoseconds"), //
@Hint(value = "42 μs", description = "A duration in microseconds"), //
@Hint(value = "42 ms", description = "A duration in milliseconds"), //
@Hint(value = "42 s ", description = "A duration in seconds"), //
@Hint(value = "42 m ", description = "A duration in minutes"), //
@Hint(value = "42 h ", description = "A duration in hours"), //
@Hint(value = "42 d ", description = "A duration in days") //
}))
public static final String DEFAULT_TEST_METHOD_TIMEOUT_PROPERTY_NAME = Timeout.DEFAULT_TEST_METHOD_TIMEOUT_PROPERTY_NAME;

/**
Expand All @@ -356,7 +385,16 @@ public final class Constants {
*
* @see Timeout#DEFAULT_TEST_TEMPLATE_METHOD_TIMEOUT_PROPERTY_NAME
*/
@ConfigurationParameter(type = String.class)
@ConfigurationParameter(type = String.class, hints = @Hints(permitsAdditionalValues = true, value = { //
@Hint(value = "42 ", description = "A duration in seconds"), //
@Hint(value = "42 ns", description = "A duration in nanoseconds"), //
@Hint(value = "42 μs", description = "A duration in microseconds"), //
@Hint(value = "42 ms", description = "A duration in milliseconds"), //
@Hint(value = "42 s ", description = "A duration in seconds"), //
@Hint(value = "42 m ", description = "A duration in minutes"), //
@Hint(value = "42 h ", description = "A duration in hours"), //
@Hint(value = "42 d ", description = "A duration in days") //
}))
public static final String DEFAULT_TEST_TEMPLATE_METHOD_TIMEOUT_PROPERTY_NAME = Timeout.DEFAULT_TEST_TEMPLATE_METHOD_TIMEOUT_PROPERTY_NAME;

/**
Expand All @@ -365,15 +403,33 @@ public final class Constants {
*
* @see Timeout#DEFAULT_TEST_FACTORY_METHOD_TIMEOUT_PROPERTY_NAME
*/
@ConfigurationParameter(type = String.class)
@ConfigurationParameter(type = String.class, hints = @Hints(permitsAdditionalValues = true, value = { //
@Hint(value = "42 ", description = "A duration in seconds"), //
@Hint(value = "42 ns", description = "A duration in nanoseconds"), //
@Hint(value = "42 μs", description = "A duration in microseconds"), //
@Hint(value = "42 ms", description = "A duration in milliseconds"), //
@Hint(value = "42 s ", description = "A duration in seconds"), //
@Hint(value = "42 m ", description = "A duration in minutes"), //
@Hint(value = "42 h ", description = "A duration in hours"), //
@Hint(value = "42 d ", description = "A duration in days") //
}))
public static final String DEFAULT_TEST_FACTORY_METHOD_TIMEOUT_PROPERTY_NAME = Timeout.DEFAULT_TEST_FACTORY_METHOD_TIMEOUT_PROPERTY_NAME;

/**
* Property name used to set the default timeout for all lifecycle methods: {@value}
*
* @see Timeout#DEFAULT_LIFECYCLE_METHOD_TIMEOUT_PROPERTY_NAME
*/
@ConfigurationParameter(type = String.class)
@ConfigurationParameter(type = String.class, hints = @Hints(permitsAdditionalValues = true, value = { //
@Hint(value = "42 ", description = "A duration in seconds"), //
@Hint(value = "42 ns", description = "A duration in nanoseconds"), //
@Hint(value = "42 μs", description = "A duration in microseconds"), //
@Hint(value = "42 ms", description = "A duration in milliseconds"), //
@Hint(value = "42 s ", description = "A duration in seconds"), //
@Hint(value = "42 m ", description = "A duration in minutes"), //
@Hint(value = "42 h ", description = "A duration in hours"), //
@Hint(value = "42 d ", description = "A duration in days") //
}))
public static final String DEFAULT_LIFECYCLE_METHOD_TIMEOUT_PROPERTY_NAME = Timeout.DEFAULT_LIFECYCLE_METHOD_TIMEOUT_PROPERTY_NAME;

/**
Expand All @@ -382,7 +438,16 @@ public final class Constants {
*
* @see Timeout#DEFAULT_BEFORE_ALL_METHOD_TIMEOUT_PROPERTY_NAME
*/
@ConfigurationParameter(type = String.class)
@ConfigurationParameter(type = String.class, hints = @Hints(permitsAdditionalValues = true, value = { //
@Hint(value = "42 ", description = "A duration in seconds"), //
@Hint(value = "42 ns", description = "A duration in nanoseconds"), //
@Hint(value = "42 μs", description = "A duration in microseconds"), //
@Hint(value = "42 ms", description = "A duration in milliseconds"), //
@Hint(value = "42 s ", description = "A duration in seconds"), //
@Hint(value = "42 m ", description = "A duration in minutes"), //
@Hint(value = "42 h ", description = "A duration in hours"), //
@Hint(value = "42 d ", description = "A duration in days") //
}))
public static final String DEFAULT_BEFORE_ALL_METHOD_TIMEOUT_PROPERTY_NAME = Timeout.DEFAULT_BEFORE_ALL_METHOD_TIMEOUT_PROPERTY_NAME;

/**
Expand All @@ -391,7 +456,16 @@ public final class Constants {
*
* @see Timeout#DEFAULT_BEFORE_EACH_METHOD_TIMEOUT_PROPERTY_NAME
*/
@ConfigurationParameter(type = String.class)
@ConfigurationParameter(type = String.class, hints = @Hints(permitsAdditionalValues = true, value = { //
@Hint(value = "42 ", description = "A duration in seconds"), //
@Hint(value = "42 ns", description = "A duration in nanoseconds"), //
@Hint(value = "42 μs", description = "A duration in microseconds"), //
@Hint(value = "42 ms", description = "A duration in milliseconds"), //
@Hint(value = "42 s ", description = "A duration in seconds"), //
@Hint(value = "42 m ", description = "A duration in minutes"), //
@Hint(value = "42 h ", description = "A duration in hours"), //
@Hint(value = "42 d ", description = "A duration in days") //
}))
public static final String DEFAULT_BEFORE_EACH_METHOD_TIMEOUT_PROPERTY_NAME = Timeout.DEFAULT_BEFORE_EACH_METHOD_TIMEOUT_PROPERTY_NAME;

/**
Expand All @@ -400,7 +474,16 @@ public final class Constants {
*
* @see Timeout#DEFAULT_AFTER_EACH_METHOD_TIMEOUT_PROPERTY_NAME
*/
@ConfigurationParameter(type = String.class)
@ConfigurationParameter(type = String.class, hints = @Hints(permitsAdditionalValues = true, value = { //
@Hint(value = "42 ", description = "A duration in seconds"), //
@Hint(value = "42 ns", description = "A duration in nanoseconds"), //
@Hint(value = "42 μs", description = "A duration in microseconds"), //
@Hint(value = "42 ms", description = "A duration in milliseconds"), //
@Hint(value = "42 s ", description = "A duration in seconds"), //
@Hint(value = "42 m ", description = "A duration in minutes"), //
@Hint(value = "42 h ", description = "A duration in hours"), //
@Hint(value = "42 d ", description = "A duration in days") //
}))
public static final String DEFAULT_AFTER_EACH_METHOD_TIMEOUT_PROPERTY_NAME = Timeout.DEFAULT_AFTER_EACH_METHOD_TIMEOUT_PROPERTY_NAME;

/**
Expand All @@ -409,15 +492,24 @@ public final class Constants {
*
* @see Timeout#DEFAULT_AFTER_ALL_METHOD_TIMEOUT_PROPERTY_NAME
*/
@ConfigurationParameter(type = String.class)
@ConfigurationParameter(type = String.class, hints = @Hints(permitsAdditionalValues = true, value = { //
@Hint(value = "42 ", description = "A duration in seconds"), //
@Hint(value = "42 ns", description = "A duration in nanoseconds"), //
@Hint(value = "42 μs", description = "A duration in microseconds"), //
@Hint(value = "42 ms", description = "A duration in milliseconds"), //
@Hint(value = "42 s ", description = "A duration in seconds"), //
@Hint(value = "42 m ", description = "A duration in minutes"), //
@Hint(value = "42 h ", description = "A duration in hours"), //
@Hint(value = "42 d ", description = "A duration in days") //
}))
public static final String DEFAULT_AFTER_ALL_METHOD_TIMEOUT_PROPERTY_NAME = Timeout.DEFAULT_AFTER_ALL_METHOD_TIMEOUT_PROPERTY_NAME;

/**
* Property name used to configure whether timeouts are applied to tests: {@value}
*
* @see Timeout#TIMEOUT_MODE_PROPERTY_NAME
*/
@ConfigurationParameter(defaultValue = @Value(stringValue = Timeout.TIMEOUT_MODE_DEFAULT))
@ConfigurationParameter(type = Timeout.TimeoutMode.class, defaultValue = @Value(stringValue = Timeout.TIMEOUT_MODE_DEFAULT))
public static final String TIMEOUT_MODE_PROPERTY_NAME = Timeout.TIMEOUT_MODE_PROPERTY_NAME;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@
* {@link Timeout @Timeout} is applied to tests.</p>
*
* <p>Value must be one names of enum constants defined in
* {@link ThreadMode}, ignoring case. If not specified, the default is
* {@link TimeoutMode}, ignoring case. If not specified, the default is
* {@value #TIMEOUT_MODE_DEFAULT}.
*
* @since 5.6
Expand Down Expand Up @@ -400,4 +400,20 @@ enum ThreadMode {
SEPARATE_THREAD,
}

@API(status = STABLE, since = "6.2")
enum TimeoutMode {
/**
* Timeouts are applied to tests.
*/
ENABLED,
/**
* Timeouts are not applied to tests.
*/
DISABLED,
/**
* Timeouts are not applied to tests when the JVM is started in debug mode.
*/
DISABLED_ON_DEBUG
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.util.function.Supplier;

import org.junit.jupiter.api.Timeout.ThreadMode;
import org.junit.jupiter.api.Timeout.TimeoutMode;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.engine.config.EnumConfigurationParameterConverter;
import org.junit.platform.commons.logging.Logger;
Expand All @@ -53,7 +54,7 @@ class TimeoutConfiguration {
this.extensionContext = extensionContext;
this.timeoutDisabled = new EnumConfigurationParameterConverter<>(TimeoutMode.class, "timeout mode") //
.get(extensionContext, TIMEOUT_MODE_PROPERTY_NAME) //
.map(TimeoutMode::isTimeoutDisabled) //
.map(TimeoutConfiguration::isTimeoutDisabled) //
.orElse(false);
}

Expand Down Expand Up @@ -138,30 +139,12 @@ private Optional<ThreadMode> parseTimeoutThreadModeConfiguration() {
.get(extensionContext, DEFAULT_TIMEOUT_THREAD_MODE_PROPERTY_NAME);
}

private enum TimeoutMode {

ENABLED {
@Override
boolean isTimeoutDisabled() {
return false;
}
},

DISABLED {
@Override
boolean isTimeoutDisabled() {
return true;
}
},

DISABLED_ON_DEBUG {
@Override
boolean isTimeoutDisabled() {
return RuntimeUtils.isDebugMode();
}
private static boolean isTimeoutDisabled(TimeoutMode timeoutMode) {
return switch (timeoutMode) {
case ENABLED -> false;
case DISABLED -> true;
case DISABLED_ON_DEBUG -> RuntimeUtils.isDebugMode();
};

abstract boolean isTimeoutDisabled();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@
*/
Deprecation deprecation() default @Deprecation;

/**
* Hints for valid values for the parameter.
* <p>
* Can be omitted when {@link #type()} is an enum or interface.
*
* @return hints for valid values about the parameter.
*/
Hints hints() default @Hints;

@interface Deprecation {
/**
* A brief description of why the parameter was deprecated.
Expand Down Expand Up @@ -129,8 +138,41 @@

/**
* The {@link Class} value to use as the default.
*
* <p>When the default is a class value, the {@link ConfigurationParameter#type()}
* should also be set.
*/
Class<?>[] classValue() default {};
}

@interface Hints {
/**
* Valid values for the value of the parameter.
*
* @return valid values for the value of the parameter.
*/
Hint[] value() default {};

/**
* Returns true if values other than the provided hints are allowed.
* By default, is assumed the hints are exhaustive.
*
* @return true if values other than the provided hints are allowed.
*/
boolean permitsAdditionalValues() default false;
}

@interface Hint {

/**
* A valid value for the configuration parameter.
*/
String value() default "";

/**
* A short description of the value.
*/
String description() default "";

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@
/// {@code .}. Likewise {@code {@code}} and {@code {@link}} tags are replaced
/// with plain text versions.
///
/// <h5>Hints</h5>
///
/// When the {@linkplain org.junit.platform.configuration.api.ConfigurationParameter#type() type}
/// or the type of the {@linkplain org.junit.platform.configuration.api.ConfigurationParameter#defaultValue() default value}
/// is a boolean, enum, or interface, hints are automatically generated.
module org.junit.platform.configuration.processor {
requires static transitive org.jspecify;
requires static transitive org.apiguardian.api;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,28 @@ private AnnotationMirrorUtil() {
.orElse(null);
}

static @Nullable AnnotationValue getAnnotationValue(AnnotationMirror annotation, String name) {
for (var entry : annotation.getElementValues().entrySet()) {
if (entry.getKey().getSimpleName().toString().equals(name)) {
return entry.getValue();
}
}
return null;
}

@SuppressWarnings("unchecked")
static @Nullable List<AnnotationMirror> getAnnotationMirrorList(AnnotationMirror annotation, String name) {
for (var entry : annotation.getElementValues().entrySet()) {
if (entry.getKey().getSimpleName().toString().equals(name)) {
var value = entry.getValue().getValue();
if (value instanceof List<?> list) {
return (List<AnnotationMirror>) list;
}
}
}
return null;
}

static Map<String, List<Object>> getValuesMap(AnnotationMirror annotation) {
return annotation.getElementValues().entrySet() //
.stream() //
Expand Down
Loading
Loading