23
23
import java .util .Set ;
24
24
25
25
import org .gradle .testkit .runner .BuildResult ;
26
- import org .gradle . util . GradleVersion ;
27
- import org .junit .jupiter .api .TestTemplate ;
26
+ import org .junit . jupiter . api . Test ;
27
+ import org .junit .jupiter .api .extension . ExtendWith ;
28
28
29
- import org .springframework .boot .gradle .junit .GradleCompatibility ;
30
29
import org .springframework .boot .testsupport .gradle .testkit .GradleBuild ;
30
+ import org .springframework .boot .testsupport .gradle .testkit .GradleBuildExtension ;
31
31
32
32
import static org .assertj .core .api .Assertions .assertThat ;
33
33
36
36
*
37
37
* @author Andy Wilkinson
38
38
*/
39
- @ GradleCompatibility
39
+ @ ExtendWith ( GradleBuildExtension . class )
40
40
class KotlinPluginActionIntegrationTests {
41
41
42
- GradleBuild gradleBuild ;
42
+ GradleBuild gradleBuild = new GradleBuild () ;
43
43
44
- @ TestTemplate
44
+ @ Test
45
45
void noKotlinVersionPropertyWithoutKotlinPlugin () {
46
46
assertThat (this .gradleBuild .build ("kotlinVersion" ).getOutput ()).contains ("Kotlin version: none" );
47
47
}
48
48
49
- @ TestTemplate
49
+ @ Test
50
50
void kotlinVersionPropertyIsSet () {
51
- String output = this .gradleBuild .expectDeprecationWarningsWithAtLeastVersion ("8.1-rc-1" )
52
- .build ("kotlinVersion" , "dependencies" , "--configuration" , "compileClasspath" )
51
+ String output = this .gradleBuild .build ("kotlinVersion" , "dependencies" , "--configuration" , "compileClasspath" )
53
52
.getOutput ();
54
53
assertThat (output ).containsPattern ("Kotlin version: [0-9]\\ .[0-9]\\ .[0-9]+" );
55
54
}
56
55
57
- @ TestTemplate
56
+ @ Test
58
57
void kotlinCompileTasksUseJavaParametersFlagByDefault () {
59
- assertThat (this .gradleBuild .expectDeprecationWarningsWithAtLeastVersion ("8.1-rc-1" )
60
- .build ("kotlinCompileTasksJavaParameters" )
61
- .getOutput ()).contains ("compileKotlin java parameters: true" )
58
+ assertThat (this .gradleBuild .build ("kotlinCompileTasksJavaParameters" ).getOutput ())
59
+ .contains ("compileKotlin java parameters: true" )
62
60
.contains ("compileTestKotlin java parameters: true" );
63
61
}
64
62
65
- @ TestTemplate
63
+ @ Test
66
64
void kotlinCompileTasksCanOverrideDefaultJavaParametersFlag () {
67
- assertThat (this .gradleBuild .expectDeprecationWarningsWithAtLeastVersion ("8.1-rc-1" )
68
- .build ("kotlinCompileTasksJavaParameters" )
69
- .getOutput ()).contains ("compileKotlin java parameters: false" )
65
+ assertThat (this .gradleBuild .build ("kotlinCompileTasksJavaParameters" ).getOutput ())
66
+ .contains ("compileKotlin java parameters: false" )
70
67
.contains ("compileTestKotlin java parameters: false" );
71
68
}
72
69
73
- @ TestTemplate
70
+ @ Test
74
71
void taskConfigurationIsAvoided () throws IOException {
75
- BuildResult result = this .gradleBuild .expectDeprecationWarningsWithAtLeastVersion ( "8.1-rc-1" ). build ("help" );
72
+ BuildResult result = this .gradleBuild .build ("help" );
76
73
String output = result .getOutput ();
77
74
BufferedReader reader = new BufferedReader (new StringReader (output ));
78
75
String line ;
@@ -82,12 +79,7 @@ void taskConfigurationIsAvoided() throws IOException {
82
79
configured .add (line .substring ("Configuring :" .length ()));
83
80
}
84
81
}
85
- if (GradleVersion .version (this .gradleBuild .getGradleVersion ()).compareTo (GradleVersion .version ("7.3.3" )) < 0 ) {
86
- assertThat (configured ).containsExactly ("help" );
87
- }
88
- else {
89
- assertThat (configured ).containsExactlyInAnyOrder ("help" , "clean" );
90
- }
82
+ assertThat (configured ).containsExactlyInAnyOrder ("help" , "clean" );
91
83
}
92
84
93
85
}
0 commit comments