Skip to content

Commit d48c756

Browse files
Added additional unit tests
1 parent bf7c9b5 commit d48c756

4 files changed

Lines changed: 201 additions & 37 deletions

File tree

tools/src/test/java/org/cyclonedx/schema/SchemaVerificationTest.java

Lines changed: 9 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -136,55 +136,27 @@ public void testInvalidLicenseIdCount() {
136136
public void testInvalidLicenseNameCount() {
137137
Assert.assertFalse(isValid(CycloneDxSchema.Version.VERSION_11, "/invalid-license-name-count-1.1.xml"));
138138
}
139-
/*
140-
@Test
141-
public void test() {
142-
}
143-
144-
@Test
145-
public void test() {
146-
}
147-
148-
@Test
149-
public void test() {
150-
}
151-
152-
@Test
153-
public void test() {
154-
}
155-
156-
@Test
157-
public void test() {
158-
}
159139

160140
@Test
161-
public void test() {
141+
public void testValidComponentRef() {
142+
Assert.assertTrue(isValid(CycloneDxSchema.Version.VERSION_11, "/valid-component-ref-1.1.xml"));
162143
}
163144

164145
@Test
165-
public void test() {
146+
public void testInvalidComponentRef() {
147+
Assert.assertFalse(isValid(CycloneDxSchema.Version.VERSION_11, "/invalid-component-ref-1.1.xml"));
166148
}
167149

168150
@Test
169-
public void test() {
151+
public void testValidExternalElements() {
152+
Assert.assertTrue(isValid(CycloneDxSchema.Version.VERSION_11, "/valid-external-elements-1.1.xml"));
170153
}
171154

172-
@Test
173-
public void test() {
174-
}
175-
176-
@Test
177-
public void test() {
178-
}
179-
180-
181-
182-
183-
184-
*/
185-
186155
@Test
187156
public void testValidXmlSignature() {
157+
// NOTE: Doesn't actually validate XML Signature. That is a business-case detail, not an
158+
// implementation requirement. If the business case requires signature validation, it should
159+
// be performed after document validation.
188160
Assert.assertTrue(isValid(CycloneDxSchema.Version.VERSION_11, "/valid-xml-signature-1.1.xml"));
189161
}
190162

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0"?>
2+
<bom serialNumber="urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79" version="1" xmlns="http://cyclonedx.org/schema/bom/1.1">
3+
<components>
4+
<component type="library" bom-ref="123">
5+
<name>acme-library</name>
6+
<version>1.0.0</version>
7+
<components>
8+
<component type="library" bom-ref="123">
9+
<name>acme-library</name>
10+
<version>1.0.0</version>
11+
</component>
12+
</components>
13+
</component>
14+
</components>
15+
</bom>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0"?>
2+
<bom serialNumber="urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79" version="1" xmlns="http://cyclonedx.org/schema/bom/1.1">
3+
<components>
4+
<component type="library" bom-ref="123">
5+
<name>acme-library</name>
6+
<version>1.0.0</version>
7+
<components>
8+
<component type="library" bom-ref="456">
9+
<name>acme-library</name>
10+
<version>1.0.0</version>
11+
</component>
12+
</components>
13+
</component>
14+
<component type="library" bom-ref="789">
15+
<name>acme-library</name>
16+
<version>1.0.0</version>
17+
</component>
18+
</components>
19+
</bom>

0 commit comments

Comments
 (0)