@@ -16,13 +16,14 @@ class GradleParserTest {
1616  @ Test 
1717  void  testExtractMuzzleVersions_SinglePassBlock () {
1818    String  gradleBuildFileContent  =
19-         "muzzle {\n " 
20-             + "  pass {\n " 
21-             + "    group.set(\" org.elasticsearch.client\" )\n " 
22-             + "    module.set(\" rest\" )\n " 
23-             + "    versions.set(\" [5.0,6.4)\" )\n " 
24-             + "  }\n " 
25-             + "}" ;
19+         """ 
20+             muzzle { 
21+               pass { 
22+                 group.set("org.elasticsearch.client") 
23+                 module.set("rest") 
24+                 versions.set("[5.0,6.4)") 
25+               } 
26+             }""" ;
2627    DependencyInfo  info  =
2728        GradleParser .parseGradleFile (gradleBuildFileContent , InstrumentationType .JAVAAGENT );
2829    assertThat (info .versions ().size ()).isEqualTo (1 );
@@ -33,7 +34,10 @@ void testExtractMuzzleVersions_SinglePassBlock() {
3334  @ Test 
3435  void  testExtractLibraryVersion () {
3536    String  gradleBuildFileContent  =
36-         "dependencies {\n "  + "  library(\" org.apache.httpcomponents:httpclient:4.3\" )\n "  + "}" ;
37+         """ 
38+             dependencies { 
39+               library("org.apache.httpcomponents:httpclient:4.3") 
40+             }""" ;
3741    DependencyInfo  info  =
3842        GradleParser .parseGradleFile (gradleBuildFileContent , InstrumentationType .LIBRARY );
3943    assertThat (info .versions ().size ()).isEqualTo (1 );
@@ -44,11 +48,12 @@ void testExtractLibraryVersion() {
4448  @ Test 
4549  void  testExtractLibraryUpperVersion () {
4650    String  gradleBuildFileContent  =
47-         "dependencies {\n " 
48-             + "  library(\" org.apache.httpcomponents:httpclient:4.3\" )\n " 
49-             + "  testImplementation(project(\" :instrumentation:apache-httpclient:apache-httpclient-4.3:testing\" ))\n " 
50-             + "  latestDepTestLibrary(\" org.apache.httpcomponents:httpclient:4.+\" ) // see apache-httpclient-5.0 module\n " 
51-             + "}" ;
51+         """ 
52+             dependencies { 
53+               library("org.apache.httpcomponents:httpclient:4.3") 
54+               testImplementation(project(":instrumentation:apache-httpclient:apache-httpclient-4.3:testing")) 
55+               latestDepTestLibrary("org.apache.httpcomponents:httpclient:4.+") // see apache-httpclient-5.0 module 
56+             }""" ;
5257
5358    DependencyInfo  info  =
5459        GradleParser .parseGradleFile (gradleBuildFileContent , InstrumentationType .LIBRARY );
@@ -122,35 +127,37 @@ void testExtractMinimumJavaVersionIgnoredWithinIfCondition() {
122127  @ Test 
123128  void  testExtractMuzzleVersions_MultiplePassBlocks () {
124129    String  gradleBuildFileContent  =
125-         "plugins {\n " 
126-             + "  id(\" otel.javaagent-instrumentation\" )\n " 
127-             + "  id(\" otel.nullaway-conventions\" )\n " 
128-             + "  id(\" otel.scala-conventions\" )\n " 
129-             + "}\n " 
130-             + "\n " 
131-             + "val zioVersion = \" 2.0.0\" \n " 
132-             + "val scalaVersion = \" 2.12\" \n " 
133-             + "\n " 
134-             + "muzzle {\n " 
135-             + "  pass {\n " 
136-             + "    group.set(\" dev.zio\" )\n " 
137-             + "    module.set(\" zio_2.12\" )\n " 
138-             + "    versions.set(\" [$zioVersion,)\" )\n " 
139-             + "    assertInverse.set(true)\n " 
140-             + "  }\n " 
141-             + "  pass {\n " 
142-             + "    group.set(\" dev.zio\" )\n " 
143-             + "    module.set(\" zio_2.13\" )\n " 
144-             + "    versions.set(\" [$zioVersion,)\" )\n " 
145-             + "    assertInverse.set(true)\n " 
146-             + "  }\n " 
147-             + "  pass {\n " 
148-             + "    group.set(\" dev.zio\" )\n " 
149-             + "    module.set(\" zio_3\" )\n " 
150-             + "    versions.set(\" [$zioVersion,)\" )\n " 
151-             + "    assertInverse.set(true)\n " 
152-             + "  }\n " 
153-             + "}\n " ;
130+         """ 
131+           plugins { 
132+             id("otel.javaagent-instrumentation") 
133+             id("otel.nullaway-conventions") 
134+             id("otel.scala-conventions") 
135+           } 
136+ 
137+           val zioVersion = "2.0.0" 
138+           val scalaVersion = "2.12" 
139+ 
140+           muzzle { 
141+             pass { 
142+               group.set("dev.zio") 
143+               module.set("zio_2.12") 
144+               versions.set("[$zioVersion,)") 
145+               assertInverse.set(true) 
146+             } 
147+             pass { 
148+               group.set("dev.zio") 
149+               module.set("zio_2.13") 
150+               versions.set("[$zioVersion,)") 
151+               assertInverse.set(true) 
152+             } 
153+             pass { 
154+               group.set("dev.zio") 
155+               module.set("zio_3") 
156+               versions.set("[$zioVersion,)") 
157+               assertInverse.set(true) 
158+             } 
159+           } 
160+           """ ;
154161
155162    DependencyInfo  info  =
156163        GradleParser .parseGradleFile (gradleBuildFileContent , InstrumentationType .JAVAAGENT );
@@ -162,23 +169,25 @@ void testExtractMuzzleVersions_MultiplePassBlocks() {
162169  @ Test 
163170  void  testExtractLogbackLibrary () {
164171    String  gradleBuildFileContent  =
165-         "compileOnly(\" ch.qos.logback:logback-classic\" ) {\n " 
166-             + "  version {\n " 
167-             + "    // compiling against newer version than the earliest supported version (1.0.0) to support\n " 
168-             + "    // features added in 1.3.0\n " 
169-             + "    strictly(\" 1.3.0\" )\n " 
170-             + "  }\n " 
171-             + "}\n " 
172-             + "compileOnly(\" org.slf4j:slf4j-api\" ) {\n " 
173-             + "  version {\n " 
174-             + "    strictly(\" 2.0.0\" )\n " 
175-             + "  }\n " 
176-             + "}\n " 
177-             + "compileOnly(\" net.logstash.logback:logstash-logback-encoder\" ) {\n " 
178-             + "  version {\n " 
179-             + "    strictly(\" 3.0\" )\n " 
180-             + "  }\n " 
181-             + "}\n " ;
172+         """ 
173+           compileOnly("ch.qos.logback:logback-classic") { 
174+             version { 
175+               // compiling against newer version than the earliest supported version (1.0.0) to support 
176+               // features added in 1.3.0 
177+               strictly("1.3.0") 
178+             } 
179+           } 
180+           compileOnly("org.slf4j:slf4j-api") { 
181+             version { 
182+               strictly("2.0.0") 
183+             } 
184+           } 
185+           compileOnly("net.logstash.logback:logstash-logback-encoder") { 
186+             version { 
187+               strictly("3.0") 
188+             } 
189+           } 
190+           """ ;
182191
183192    DependencyInfo  info  =
184193        GradleParser .parseGradleFile (gradleBuildFileContent , InstrumentationType .LIBRARY );
0 commit comments