diff --git a/src/test/java/org/dependencytrack/resources/v1/VulnerabilityResourceTest.java b/src/test/java/org/dependencytrack/resources/v1/VulnerabilityResourceTest.java index 43c25361a..9f6d4415c 100644 --- a/src/test/java/org/dependencytrack/resources/v1/VulnerabilityResourceTest.java +++ b/src/test/java/org/dependencytrack/resources/v1/VulnerabilityResourceTest.java @@ -75,10 +75,6 @@ public void getVulnerabilitiesByComponentUuidTest() throws Exception { "source": "INTERNAL", "description": "Description 1", "severity": "CRITICAL", - "cwe": { - "cweId": 123, - "name": "Write-what-where Condition" - }, "cwes": [ { "cweId": 123, @@ -95,10 +91,6 @@ public void getVulnerabilitiesByComponentUuidTest() throws Exception { "source": "INTERNAL", "description": "Description 2", "severity": "HIGH", - "cwe": { - "cweId": 321, - "name": "Use of Hard-coded Cryptographic Key" - }, "cwes": [ { "cweId": 321, @@ -143,10 +135,6 @@ public void getVulnerabilitiesByComponentUuidIncludeSuppressedTest() { "source": "INTERNAL", "description": "Description 1", "severity": "CRITICAL", - "cwe": { - "cweId": 123, - "name": "Write-what-where Condition" - }, "cwes": [ { "cweId": 123, @@ -163,10 +151,6 @@ public void getVulnerabilitiesByComponentUuidIncludeSuppressedTest() { "source": "INTERNAL", "description": "Description 2", "severity": "HIGH", - "cwe": { - "cweId": 321, - "name": "Use of Hard-coded Cryptographic Key" - }, "cwes": [ { "cweId": 321, @@ -207,10 +191,6 @@ public void getVulnerabilitiesByProjectTest() throws Exception { "source": "INTERNAL", "description": "Description 1", "severity": "CRITICAL", - "cwe": { - "cweId": 123, - "name": "Write-what-where Condition" - }, "cwes": [ { "cweId": 123, @@ -239,10 +219,6 @@ public void getVulnerabilitiesByProjectTest() throws Exception { "source": "INTERNAL", "description": "Description 2", "severity": "HIGH", - "cwe": { - "cweId": 321, - "name": "Use of Hard-coded Cryptographic Key" - }, "cwes": [ { "cweId": 321, @@ -271,10 +247,6 @@ public void getVulnerabilitiesByProjectTest() throws Exception { "source": "INTERNAL", "description": "Description 4", "severity": "LOW", - "cwe": { - "cweId": 123, - "name": "Write-what-where Condition" - }, "cwes": [ { "cweId": 123, @@ -345,10 +317,6 @@ public void getVulnerabilitiesByProjectIncludeProjectSuppressedTest() throws Exc "source": "INTERNAL", "description": "Description 4", "severity": "LOW", - "cwe": { - "cweId": 123, - "name": "Write-what-where Condition" - }, "cwes": [ { "cweId": 123, @@ -650,8 +618,6 @@ public void createVulnerabilityTest() { Assert.assertEquals(1.75, json.getJsonNumber("owaspRRBusinessImpactScore").doubleValue(), 0); Assert.assertEquals("SL:1/M:1/O:0/S:2/ED:1/EE:1/A:1/ID:1/LC:2/LI:1/LAV:1/LAC:1/FD:1/RD:1/NC:2/PV:3", json.getString("owaspRRVector")); Assert.assertEquals("MEDIUM", json.getString("severity")); - Assert.assertNotNull(json.getJsonObject("cwe")); - Assert.assertEquals(80, json.getJsonObject("cwe").getInt("cweId")); Assert.assertEquals(1, json.getJsonArray("cwes").size()); Assert.assertEquals(80, json.getJsonArray("cwes").getJsonObject(0).getInt("cweId")); Assert.assertEquals("Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS)", json.getJsonArray("cwes").getJsonObject(0).getString("name")); @@ -699,7 +665,7 @@ public void createVulnerabilityWithBadOwaspVectorTest() { public void createVulnerabilityCwePreV450CompatTest() { JsonObject payload = Json.createObjectBuilder() .add("vulnId", "ACME-1") - .add("cwe", Json.createObjectBuilder().add("cweId", 80)) + .add("cwes", Json.createArrayBuilder().add(Json.createObjectBuilder().add("cweId", 80))) .build(); Response response = jersey.target(V1_VULNERABILITY).request() .header(X_API_KEY, apiKey) @@ -709,9 +675,6 @@ public void createVulnerabilityCwePreV450CompatTest() { Assert.assertNotNull(json); Assert.assertEquals("ACME-1", json.getString("vulnId")); Assert.assertEquals("INTERNAL", json.getString("source")); - Assert.assertNotNull(json.getJsonObject("cwe")); - Assert.assertEquals(80, json.getJsonObject("cwe").getInt("cweId")); - Assert.assertEquals("Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS)", json.getJsonObject("cwe").getString("name")); Assert.assertEquals(1, json.getJsonArray("cwes").size()); Assert.assertEquals(80, json.getJsonArray("cwes").getJsonObject(0).getInt("cweId")); Assert.assertEquals("Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS)", json.getJsonArray("cwes").getJsonObject(0).getString("name"));