File tree 3 files changed +13
-6
lines changed
surefire-its/src/test/resources/junit5-testtemplate-bug
3 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 22
22
<version >${junit5.version} </version >
23
23
<scope >test</scope >
24
24
</dependency >
25
+ <dependency >
26
+ <groupId >org.junit.jupiter</groupId >
27
+ <artifactId >junit-jupiter-api</artifactId >
28
+ <version >${junit5.version} </version >
29
+ <scope >test</scope >
30
+ </dependency >
25
31
<dependency >
26
32
<groupId >org.junit.jupiter</groupId >
27
33
<artifactId >junit-jupiter-params</artifactId >
Original file line number Diff line number Diff line change 8
8
import org .junit .jupiter .api .extension .TestTemplateInvocationContext ;
9
9
import org .junit .jupiter .api .extension .TestTemplateInvocationContextProvider ;
10
10
11
+ import java .util .Arrays ;
11
12
import java .util .List ;
12
13
import java .util .stream .Stream ;
13
14
@@ -44,7 +45,7 @@ private TestTemplateInvocationContext context(int parameter) {
44
45
return new TestTemplateInvocationContext () {
45
46
@ Override
46
47
public String getDisplayName (int invocationIndex ) {
47
- return "[%d] %s" . formatted ( invocationIndex , parameter );
48
+ return String . format ( "[%d] %s" , invocationIndex , parameter );
48
49
}
49
50
50
51
@ Override
@@ -55,8 +56,8 @@ public List<Extension> getAdditionalExtensions() {
55
56
}
56
57
57
58
private List <Extension > getBeforeEachCallbacks (int value ) {
58
- return List . of ( ((BeforeEachCallback ) ctx ->
59
+ return Arrays . asList ((BeforeEachCallback ) ctx ->
59
60
((FieldSettingTest ) ctx .getRequiredTestInstance ()).setTestValue (value )
60
- )) ;
61
+ );
61
62
}
62
63
}
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ public class ParamsContextTest {
19
19
20
20
@ TestTemplate
21
21
@ ExtendWith (ParamsContextProvider .class )
22
- void testTemplatePartiallyFails (Integer value ) {
22
+ void testTemplatePartiallyFails (int value ) {
23
23
assertEquals (42 , value );
24
24
}
25
25
}
@@ -40,15 +40,15 @@ private TestTemplateInvocationContext invocationContext(int parameter) {
40
40
return new TestTemplateInvocationContext () {
41
41
@ Override
42
42
public String getDisplayName (int invocationIndex ) {
43
- return "[%d] %s" . formatted ( invocationIndex , parameter );
43
+ return String . format ( "[%d] %s" , invocationIndex , parameter );
44
44
}
45
45
46
46
@ Override
47
47
public List <Extension > getAdditionalExtensions () {
48
48
return Collections .singletonList (new ParameterResolver () {
49
49
@ Override
50
50
public boolean supportsParameter (ParameterContext parameterContext , ExtensionContext extensionContext ) {
51
- return parameterContext . getParameter (). getType (). equals ( Integer . class ) ;
51
+ return true ;
52
52
}
53
53
54
54
@ Override
You can’t perform that action at this time.
0 commit comments