diff --git a/tools/pom.xml b/tools/pom.xml
index 519b8a9f..5eb0313f 100644
--- a/tools/pom.xml
+++ b/tools/pom.xml
@@ -55,7 +55,7 @@
3.6
1.12.0
1.4.9
- 8.0.3
+ 9.0.2
diff --git a/tools/src/test/java/org/cyclonedx/schema/JsonSchemaVerificationTest.java b/tools/src/test/java/org/cyclonedx/schema/JsonSchemaVerificationTest.java
index 3862bb14..c11b25ec 100644
--- a/tools/src/test/java/org/cyclonedx/schema/JsonSchemaVerificationTest.java
+++ b/tools/src/test/java/org/cyclonedx/schema/JsonSchemaVerificationTest.java
@@ -13,15 +13,16 @@
*/
package org.cyclonedx.schema;
-import org.cyclonedx.CycloneDxSchema;
-import org.cyclonedx.parsers.JsonParser;
-import org.junit.jupiter.api.DynamicTest;
-import org.junit.jupiter.api.TestFactory;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import org.cyclonedx.parsers.JsonParser;
+import org.cyclonedx.Version;
+import org.junit.jupiter.api.DynamicTest;
+import org.junit.jupiter.api.TestFactory;
+
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -33,15 +34,15 @@ Collection dynamicTestsWithCollection() throws Exception {
final List dynamicTests = new ArrayList<>();
for (final String file: files) {
if (file.endsWith(".json")) {
- final CycloneDxSchema.Version schemaVersion;
+ final Version schemaVersion;
if (file.endsWith("-1.2.json")) {
- schemaVersion = CycloneDxSchema.Version.VERSION_12;
+ schemaVersion = Version.VERSION_12;
} else if (file.endsWith("-1.3.json")) {
- schemaVersion = CycloneDxSchema.Version.VERSION_13;
+ schemaVersion = Version.VERSION_13;
} else if (file.endsWith("-1.4.json")) {
- schemaVersion = CycloneDxSchema.Version.VERSION_14;
+ schemaVersion = Version.VERSION_14;
} else if (file.endsWith("-1.5.json")) {
- schemaVersion = CycloneDxSchema.Version.VERSION_15;
+ schemaVersion = Version.VERSION_15;
} else {
schemaVersion = null;
}
@@ -57,7 +58,7 @@ Collection dynamicTestsWithCollection() throws Exception {
return dynamicTests;
}
- private boolean isValidJson(CycloneDxSchema.Version version, String resource) throws Exception {
+ private boolean isValidJson(Version version, String resource) throws Exception {
final File file = new File(this.getClass().getResource(resource).getFile());
final JsonParser parser = new JsonParser();
return parser.isValid(file, version);
diff --git a/tools/src/test/java/org/cyclonedx/schema/XmlSchemaVerificationTest.java b/tools/src/test/java/org/cyclonedx/schema/XmlSchemaVerificationTest.java
index 01434b00..a56e77e3 100644
--- a/tools/src/test/java/org/cyclonedx/schema/XmlSchemaVerificationTest.java
+++ b/tools/src/test/java/org/cyclonedx/schema/XmlSchemaVerificationTest.java
@@ -13,39 +13,46 @@
*/
package org.cyclonedx.schema;
-import org.cyclonedx.CycloneDxSchema;
-import org.cyclonedx.parsers.XmlParser;
-import org.junit.jupiter.api.DynamicTest;
-import org.junit.jupiter.api.TestFactory;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import org.cyclonedx.parsers.XmlParser;
+import org.cyclonedx.Version;
+import org.junit.jupiter.api.DynamicTest;
+import org.junit.jupiter.api.TestFactory;
+
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertFalse;
public class XmlSchemaVerificationTest extends BaseSchemaVerificationTest {
@TestFactory
+ /**
+ * Generates a collection of dynamic tests based on the available XML files.
+ *
+ * @return Collection a collection of dynamic tests
+ * @throws Exception if an error occurs during the generation of the dynamic tests
+ */
Collection dynamicTestsWithCollection() throws Exception {
final List files = getAllResources();
final List dynamicTests = new ArrayList<>();
for (final String file: files) {
if (file.endsWith(".xml")) {
- final CycloneDxSchema.Version schemaVersion;
+ final Version schemaVersion;
if (file.endsWith("-1.0.xml")) {
- schemaVersion = CycloneDxSchema.Version.VERSION_10;
+ schemaVersion = Version.VERSION_10;
} else if (file.endsWith("-1.1.xml")) {
- schemaVersion = CycloneDxSchema.Version.VERSION_11;
+ schemaVersion = Version.VERSION_11;
} else if (file.endsWith("-1.2.xml")) {
- schemaVersion = CycloneDxSchema.Version.VERSION_12;
+ schemaVersion = Version.VERSION_12;
} else if (file.endsWith("-1.3.xml")) {
- schemaVersion = CycloneDxSchema.Version.VERSION_13;
+ schemaVersion = Version.VERSION_13;
} else if (file.endsWith("-1.4.xml")) {
- schemaVersion = CycloneDxSchema.Version.VERSION_14;
+ schemaVersion = Version.VERSION_14;
} else if (file.endsWith("-1.5.xml")) {
- schemaVersion = CycloneDxSchema.Version.VERSION_15;
+ schemaVersion = Version.VERSION_15;
} else {
schemaVersion = null;
}
@@ -61,7 +68,15 @@ Collection dynamicTestsWithCollection() throws Exception {
return dynamicTests;
}
- private boolean isValid(CycloneDxSchema.Version version, String resource) throws Exception {
+ /**
+ * Validates the given XML file against the specified CycloneDX schema version.
+ *
+ * @param version the CycloneDX schema version to validate against
+ * @param resource the path to the XML file to be validated
+ * @return boolean true if the XML file is valid according to the specified schema version, false otherwise
+ * @throws Exception if an error occurs during the validation process
+ */
+ private boolean isValid(Version version, String resource) throws Exception {
final File file = new File(this.getClass().getResource(resource).getFile());
final XmlParser parser = new XmlParser();
return parser.isValid(file, version);