Skip to content

Commit 291ee07

Browse files
committed
Merge branch 'refs/heads/main' into #3102_allow_to_inherit_resource_locks
2 parents fdec3f1 + de40dbe commit 291ee07

File tree

19 files changed

+58
-26
lines changed

19 files changed

+58
-26
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,6 @@ gradle-app.setting
3131
coverage.db*
3232
.metadata
3333
/.sdkmanrc
34+
/.tool-versions
3435

3536
checksums*

documentation/documentation.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ tasks {
176176

177177
generateOpenTestHtmlReport {
178178
mustRunAfter(consoleLauncherTest)
179+
inputs.files(consoleLauncherTestEventXmlFiles).withPathSensitivity(RELATIVE).skipWhenEmpty()
179180
argumentProviders += CommandLineArgumentProvider {
180181
consoleLauncherTestEventXmlFiles.files.map { it.absolutePath }.toList()
181182
}

documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ JUnit repository on GitHub.
8585
* Extensions based on `TestTemplateInvocationContextProvider` can now allow returning zero
8686
invocation contexts by overriding the new `mayReturnZeroTestTemplateInvocationContexts`
8787
method.
88-
* The new `@ParameterizedTest(requireArguments = false)` attribute allows to specify that
89-
the absence of arguments is expected in some cases and should not cause a test failure.
88+
* The new `@ParameterizedTest(allowZeroInvocations = true)` attribute allows to specify that
89+
the absence of invocations is expected in some cases and should not cause a test failure.
9090
* Allow determining "shared resources" at runtime via the new `@ResourceLock#providers`
9191
attribute that accepts implementations of `ResourceLocksProvider`.
9292
* Allow declaring "shared resources" for _direct_ child nodes via the new

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ktlint = "1.4.1"
1616
log4j = "2.24.2"
1717
mockito = "5.14.2"
1818
opentest4j = "1.3.0"
19-
openTestReporting = "0.1.0-SNAPSHOT"
19+
openTestReporting = "0.2.0-SNAPSHOT"
2020
surefire = "3.5.2"
2121
xmlunit = "2.10.0"
2222

gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
import com.gradle.develocity.agent.gradle.internal.test.PredictiveTestSelectionConfigurationInternal
33
import com.gradle.develocity.agent.gradle.test.PredictiveTestSelectionMode
4-
import org.gradle.api.tasks.PathSensitivity.NONE
4+
import org.gradle.api.tasks.PathSensitivity.RELATIVE
55
import org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
66
import org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED
77
import org.gradle.internal.os.OperatingSystem
@@ -41,7 +41,8 @@ val generateOpenTestHtmlReport by tasks.registering(JavaExec::class) {
4141
abstract class HtmlReportParameters : CommandLineArgumentProvider {
4242

4343
@get:InputFiles
44-
@get:PathSensitive(NONE)
44+
@get:PathSensitive(RELATIVE)
45+
@get:SkipWhenEmpty
4546
abstract val eventXmlFiles: ConfigurableFileCollection
4647

4748
@get:OutputFile

junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,18 +293,18 @@
293293
boolean autoCloseArguments() default true;
294294

295295
/**
296-
* Configure whether at least one set of arguments is required for this
296+
* Configure whether zero invocations are allowed for this
297297
* parameterized test.
298298
*
299-
* <p>Set this attribute to {@code false} if the absence of arguments is
299+
* <p>Set this attribute to {@code true} if the absence of invocations is
300300
* expected in some cases and should not cause a test failure.
301301
*
302-
* <p>Defaults to {@code true}.
302+
* <p>Defaults to {@code false}.
303303
*
304304
* @since 5.12
305305
*/
306306
@API(status = EXPERIMENTAL, since = "5.12")
307-
boolean requireArguments() default true;
307+
boolean allowZeroInvocations() default false;
308308

309309
/**
310310
* Configure how the number of arguments provided by an {@link ArgumentsSource} are validated.

junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@ public Stream<TestTemplateInvocationContext> provideTestTemplateInvocationContex
8686
return createInvocationContext(formatter, methodContext, arguments, invocationCount.intValue());
8787
})
8888
.onClose(() ->
89-
Preconditions.condition(invocationCount.get() > 0 || !methodContext.annotation.requireArguments(),
89+
Preconditions.condition(invocationCount.get() > 0 || methodContext.annotation.allowZeroInvocations(),
9090
"Configuration error: You must configure at least one set of arguments for this @ParameterizedTest"));
9191
// @formatter:on
9292
}
9393

9494
@Override
9595
public boolean mayReturnZeroTestTemplateInvocationContexts(ExtensionContext extensionContext) {
9696
ParameterizedTestMethodContext methodContext = getMethodContext(extensionContext);
97-
return !methodContext.annotation.requireArguments();
97+
return methodContext.annotation.allowZeroInvocations();
9898
}
9999

100100
private ParameterizedTestMethodContext getMethodContext(ExtensionContext extensionContext) {

jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ void method() {
325325

326326
static class TestCaseAllowNoArgumentsMethod {
327327

328-
@ParameterizedTest(requireArguments = false)
328+
@ParameterizedTest(allowZeroInvocations = true)
329329
void method() {
330330
}
331331
}

jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2422,7 +2422,7 @@ void testThatRequiresArguments(String argument) {
24222422
fail("This test should not be executed, because no arguments are provided.");
24232423
}
24242424

2425-
@ParameterizedTest(requireArguments = false)
2425+
@ParameterizedTest(allowZeroInvocations = true)
24262426
@MethodSource("zeroArgumentsProvider")
24272427
void testThatDoesNotRequireArguments(String argument) {
24282428
fail("This test should not be executed, because no arguments are provided.");

platform-tests/src/test/java/org/junit/platform/reporting/open/xml/JUnitContributorTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class JUnitContributorTests {
2626
void contributesJUnitSpecificMetadata(@TempDir Path tempDir) throws Exception {
2727
var xmlFile = Files.writeString(tempDir.resolve("report.xml"),
2828
"""
29-
<e:events xmlns="https://schemas.opentest4j.org/reporting/core/0.1.0" xmlns:e="https://schemas.opentest4j.org/reporting/events/0.1.0" xmlns:java="https://schemas.opentest4j.org/reporting/java/0.1.0"
29+
<e:events xmlns="https://schemas.opentest4j.org/reporting/core/0.2.0" xmlns:e="https://schemas.opentest4j.org/reporting/events/0.2.0" xmlns:java="https://schemas.opentest4j.org/reporting/java/0.2.0"
3030
xmlns:junit="https://schemas.junit.org/open-test-reporting" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3131
xsi:schemaLocation="https://schemas.junit.org/open-test-reporting https://junit.org/junit5/schemas/open-test-reporting/junit-1.9.xsd">
3232
<e:started id="1" name="dummy" time="2024-11-10T16:31:35.000Z">

0 commit comments

Comments
 (0)