Skip to content

Commit f155571

Browse files
Spotlessppkarwasz
authored andcommitted
Formatting using Spotless
1 parent a27192b commit f155571

File tree

7 files changed

+787
-654
lines changed

7 files changed

+787
-654
lines changed

pom.xml

Lines changed: 549 additions & 531 deletions
Large diffs are not rendered by default.

src/main/java/com/github/packageurl/MalformedPackageURLException.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ public class MalformedPackageURLException extends Exception {
3737
*
3838
* @since 1.0.0
3939
*/
40-
public MalformedPackageURLException() {
41-
}
40+
public MalformedPackageURLException() {}
4241

4342
/**
4443
* Constructs a {@code MalformedPackageURLException} with the

src/main/java/com/github/packageurl/PackageURL.java

Lines changed: 92 additions & 50 deletions
Large diffs are not rendered by default.

src/main/java/com/github/packageurl/PackageURLBuilder.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ public PackageURLBuilder withoutQualifiers(final Set<String> keys) {
216216
return this;
217217
}
218218

219-
220219
/**
221220
* Removes all qualifiers, if any.
222221
* @return a reference to this builder.

src/main/java/com/github/packageurl/validator/PackageURL.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@
3333
* the JSR-303 compliant validator to validate the field to ensure it meets the Package URL specification.
3434
* @since 1.3.0
3535
*/
36-
@Target({ ElementType.FIELD})
36+
@Target({ElementType.FIELD})
3737
@Retention(RetentionPolicy.RUNTIME)
3838
@Constraint(validatedBy = PackageURLConstraintValidator.class)
3939
public @interface PackageURL {
4040

41-
String message() default "The Package URL (purl) must be a valid URI and conform to https://github.com/package-url/purl-spec";
41+
String message() default
42+
"The Package URL (purl) must be a valid URI and conform to https://github.com/package-url/purl-spec";
4243

43-
Class<?>[] groups() default { };
44+
Class<?>[] groups() default {};
4445

45-
Class<? extends Payload>[] payload() default { };
46+
Class<? extends Payload>[] payload() default {};
4647
}

src/test/java/com/github/packageurl/PackageURLBuilderTest.java

Lines changed: 57 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)