File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -2041,11 +2041,7 @@ use the `argumentCountValidation` attribute of the `@ParameterizedTest` annotati
20412041
20422042[source,java,indent=0]
20432043----
2044- @ParameterizedTest(argumentCountValidation = ArgumentCountValidationMode.STRICT)
2045- @CsvSource({ "42, -666" })
2046- void testWithArgumentCountValidation(int number) {
2047- assertTrue(number > 0);
2048- }
2044+ include::{testDir}/example/ParameterizedTestDemo.java[tags=argument_count_validation]
20492045----
20502046
20512047[[writing-tests-parameterized-tests-argument-conversion]]
Original file line number Diff line number Diff line change 5151import org .junit .jupiter .api .extension .ExtensionContext ;
5252import org .junit .jupiter .api .extension .ParameterContext ;
5353import org .junit .jupiter .api .parallel .Execution ;
54+ import org .junit .jupiter .params .ArgumentCountValidationMode ;
5455import org .junit .jupiter .params .ParameterizedTest ;
5556import org .junit .jupiter .params .aggregator .AggregateWith ;
5657import org .junit .jupiter .params .aggregator .ArgumentsAccessor ;
@@ -607,4 +608,13 @@ static Stream<String> otherProvider() {
607608 return Stream .of ("bar" );
608609 }
609610 // end::repeatable_annotations[]
611+
612+ @ extensions .ExpectToFail
613+ // tag::argument_count_validation[]
614+ @ ParameterizedTest (argumentCountValidation = ArgumentCountValidationMode .STRICT )
615+ @ CsvSource ({ "42, -666" })
616+ void testWithArgumentCountValidation (int number ) {
617+ assertTrue (number > 0 );
618+ }
619+ // end::argument_count_validation[]
610620}
You can’t perform that action at this time.
0 commit comments