@@ -46,7 +46,7 @@ void packageURLBuilder() throws MalformedPackageURLException {
4646 .withNamespace ("namespace" )
4747 .withName ("name" )
4848 .withVersion ("version" )
49- .withQualifier ("key" ,"value" )
49+ .withQualifier ("key" , "value" )
5050 .withSubpath ("subpath" )
5151 .build ();
5252
@@ -57,7 +57,7 @@ void packageURLBuilder() throws MalformedPackageURLException {
5757 .withNamespace ("namespace" )
5858 .withName ("name" )
5959 .withVersion ("version" )
60- .withQualifier ("key_1.1-" ,"value" )
60+ .withQualifier ("key_1.1-" , "value" )
6161 .withSubpath ("subpath" )
6262 .build ();
6363
@@ -68,7 +68,7 @@ void packageURLBuilder() throws MalformedPackageURLException {
6868 .withNamespace ("/////" )
6969 .withName ("name" )
7070 .withVersion ("version" )
71- .withQualifier ("key" ,"value" )
71+ .withQualifier ("key" , "value" )
7272 .withSubpath ("/////" )
7373 .build ();
7474
@@ -79,8 +79,8 @@ void packageURLBuilder() throws MalformedPackageURLException {
7979 .withNamespace ("" )
8080 .withName ("name" )
8181 .withVersion ("version" )
82- .withQualifier ("key" ,"value" )
83- .withQualifier ("next" ,"value" )
82+ .withQualifier ("key" , "value" )
83+ .withQualifier ("next" , "value" )
8484 .withSubpath ("" )
8585 .build ();
8686
@@ -92,7 +92,7 @@ void packageURLBuilderException1() throws MalformedPackageURLException {
9292 PackageURL purl = PackageURLBuilder .aPackageURL ()
9393 .withType ("type" )
9494 .withName ("name" )
95- .withQualifier ("key" ,"" )
95+ .withQualifier ("key" , "" )
9696 .build ();
9797 assertEquals (0 , purl .getQualifiers ().size (), "qualifier count" );
9898 }
@@ -102,63 +102,78 @@ void packageURLBuilderException1Null() throws MalformedPackageURLException {
102102 PackageURL purl = PackageURLBuilder .aPackageURL ()
103103 .withType ("type" )
104104 .withName ("name" )
105- .withQualifier ("key" ,null )
105+ .withQualifier ("key" , null )
106106 .build ();
107107 assertEquals (0 , purl .getQualifiers ().size (), "qualifier count" );
108108 }
109109
110110 @ Test
111111 void packageURLBuilderException2 () {
112- assertThrowsExactly (MalformedPackageURLException .class , () -> {
113- PackageURLBuilder .aPackageURL ()
114- .withType ("type" )
115- .withNamespace ("invalid//namespace" )
116- .withName ("name" )
117- .build ();
118- }, "Build should fail due to invalid namespace" );
112+ assertThrowsExactly (
113+ MalformedPackageURLException .class ,
114+ () -> {
115+ PackageURLBuilder .aPackageURL ()
116+ .withType ("type" )
117+ .withNamespace ("invalid//namespace" )
118+ .withName ("name" )
119+ .build ();
120+ },
121+ "Build should fail due to invalid namespace" );
119122 }
120123
121124 @ Test
122125 void packageURLBuilderException3 () {
123- assertThrowsExactly (MalformedPackageURLException .class , () -> {
124- PackageURLBuilder .aPackageURL ()
125- .withType ("typ^e" )
126- .withSubpath ("invalid/name%2Fspace" )
127- .withName ("name" )
128- .build ();
129- }, "Build should fail due to invalid subpath" );
126+ assertThrowsExactly (
127+ MalformedPackageURLException .class ,
128+ () -> {
129+ PackageURLBuilder .aPackageURL ()
130+ .withType ("typ^e" )
131+ .withSubpath ("invalid/name%2Fspace" )
132+ .withName ("name" )
133+ .build ();
134+ },
135+ "Build should fail due to invalid subpath" );
130136 }
131137
132138 @ Test
133139 void packageURLBuilderException4 () {
134- assertThrowsExactly (MalformedPackageURLException .class , () -> {
135- PackageURLBuilder .aPackageURL ()
136- .withType ("0_type" )
137- .withName ("name" )
138- .build ();
139- }, "Build should fail due to invalid type" );
140+ assertThrowsExactly (
141+ MalformedPackageURLException .class ,
142+ () -> {
143+ PackageURLBuilder .aPackageURL ()
144+ .withType ("0_type" )
145+ .withName ("name" )
146+ .build ();
147+ },
148+ "Build should fail due to invalid type" );
140149 }
141150
142151 @ Test
143152 void packageURLBuilderException5 () {
144- assertThrowsExactly (MalformedPackageURLException .class , () -> {
145- PackageURLBuilder .aPackageURL ()
146- .withType ("ype" )
147- .withName ("name" )
148- .withQualifier ("0_key" , "value" )
149- .build ();
150- }, "Build should fail due to invalid qualifier key" );
153+ assertThrowsExactly (
154+ MalformedPackageURLException .class ,
155+ () -> {
156+ PackageURLBuilder .aPackageURL ()
157+ .withType ("ype" )
158+ .withName ("name" )
159+ .withQualifier ("0_key" , "value" )
160+ .build ();
161+ },
162+ "Build should fail due to invalid qualifier key" );
151163 }
152164
153165 @ Test
154166 void packageURLBuilderException6 () {
155- assertThrowsExactly (MalformedPackageURLException .class , () -> {
156- PackageURLBuilder .aPackageURL ()
157- .withType ("ype" )
158- .withName ("name" )
159- .withQualifier ("" , "value" )
160- .build ();
161- }, "Build should fail due to invalid qualifier key" );
167+ assertThrowsExactly (
168+ MalformedPackageURLException .class ,
169+ () -> {
170+ PackageURLBuilder .aPackageURL ()
171+ .withType ("ype" )
172+ .withName ("name" )
173+ .withQualifier ("" , "value" )
174+ .build ();
175+ },
176+ "Build should fail due to invalid qualifier key" );
162177 }
163178
164179 @ Test
@@ -230,9 +245,7 @@ private void assertBuilderMatch(PackageURL expected, PackageURLBuilder actual) t
230245 assertEquals (eQualifiers , aQualifiers );
231246
232247 if (eQualifiers != null && aQualifiers != null ) {
233- eQualifiers .forEach ((k ,v ) ->
234- assertEquals (v , actual .getQualifier (k )));
248+ eQualifiers .forEach ((k , v ) -> assertEquals (v , actual .getQualifier (k )));
235249 }
236250 }
237-
238251}
0 commit comments