Skip to content

Commit 7c5a024

Browse files
AniiiAniii
authored andcommitted
Rename requireArguments to allowZeroInvocations
1 parent ad0ef2e commit 7c5a024

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@
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.");

0 commit comments

Comments
 (0)