@@ -23,15 +23,18 @@ class GraalpySpec extends ApplicationContextSpec implements CommandOutputFixture
23
23
@Subject
24
24
Graalpy micronautGraalPyFeature = beanContext. getBean(Graalpy )
25
25
26
- void ' readme.md with feature micronaut-graalpy contains links to docs' ( ) {
26
+ void " readme.md with feature micronaut-graalpy contains links to docs for language=#language buildTool=#buildTool " ( BuildTool buildTool, Language language ) {
27
27
when :
28
- Map<String , String > output = generate(ApplicationType . DEFAULT , new Options (Language . JAVA , TestFramework . JUNIT , BuildTool . MAVEN , JdkVersion . JDK_21 ), [Graalpy . NAME ])
28
+ Map<String , String > output = generate(ApplicationType . DEFAULT , new Options (language , TestFramework . JUNIT , buildTool , JdkVersion . JDK_21 ), [Graalpy . NAME ])
29
29
String readme = output[" README.md" ]
30
30
31
31
then :
32
32
readme
33
33
readme. contains(" https://micronaut-projects.github.io/micronaut-graal-languages/latest/guide" );
34
34
readme. contains(" https://graalvm.org/python" );
35
+
36
+ where :
37
+ [buildTool, language] << [BuildTool . values(), Language . JAVA ]. combinations()
35
38
}
36
39
37
40
void " micronaut-graalpy belongs to LANGUAGES category" () {
@@ -47,29 +50,25 @@ class GraalpySpec extends ApplicationContextSpec implements CommandOutputFixture
47
50
applicationType << ApplicationType . values()
48
51
}
49
52
50
- void " micronaut-graalpy feature adds micronaut-graalpy dependency for Java and Maven " ( ) {
53
+ void " micronaut-graalpy feature adds micronaut-graalpy dependency for language=#language buildTool=#buildTool " ( BuildTool buildTool, Language language ) {
51
54
when :
52
- String template = new BuildBuilder (beanContext, BuildTool . MAVEN )
55
+ String template = new BuildBuilder (beanContext, buildTool )
53
56
.features([Graalpy . NAME ])
54
- .language(Language . JAVA )
57
+ .language(language )
55
58
.render()
56
- BuildTestVerifier verifier = BuildTestUtil . verifier(BuildTool . MAVEN , Language . JAVA , template)
59
+ BuildTestVerifier verifier = BuildTestUtil . verifier(buildTool, language , template)
57
60
58
61
then :
59
62
template
60
63
verifier. hasDependency(" io.micronaut.graal-languages" , " micronaut-graalpy" , Scope . COMPILE )
61
- }
62
-
63
- void " micronaut-graalpy feature adds maven-graalvm-plugin for language=java buildTool=maven " () {
64
- when :
65
- String template = new BuildBuilder (beanContext, BuildTool . MAVEN )
66
- .features([Graalpy . NAME ])
67
- .language(Language . JAVA )
68
- .render()
64
+ if (buildTool == BuildTool . MAVEN ) {
65
+ assert template. contains(" <artifactId>graalpy-maven-plugin</artifactId>" )
66
+ } else if (buildTool. isGradle()) {
67
+ assert verifier. hasBuildPlugin(" org.graalvm.python" )
68
+ }
69
69
70
- then :
71
- template
72
- template. contains(" <artifactId>graalpy-maven-plugin</artifactId>" )
70
+ where :
71
+ [buildTool, language] << [BuildTool . values(), Language . JAVA ]. combinations()
73
72
}
74
73
75
74
void " micronaut-graalpy feature requires java 21" () {
@@ -84,14 +83,4 @@ class GraalpySpec extends ApplicationContextSpec implements CommandOutputFixture
84
83
ex. message == " The selected feature graalpy requires at latest Java 21"
85
84
}
86
85
87
- void ' test feature graalpy is only supported for Maven' () {
88
- given :
89
- String featureName = ' graalpy'
90
- when :
91
- getFeatures([featureName], new Options (Language . JAVA , TestFramework . JUNIT , BuildTool . GRADLE , JdkVersion . JDK_21 ))
92
-
93
- then :
94
- IllegalArgumentException ex = thrown()
95
- ex. message. contains(" Feature only supported by Maven" )
96
- }
97
86
}
0 commit comments