From 5b3d90947d938f7375f8da6f1d4510e684f7bcaf Mon Sep 17 00:00:00 2001 From: Sahiba Mittal Date: Wed, 18 Sep 2024 11:07:33 +0100 Subject: [PATCH] Update VulnerabilityResourceTest.java --- .../v1/VulnerabilityResourceTest.java | 24 ------------------- 1 file changed, 24 deletions(-) diff --git a/src/test/java/org/dependencytrack/resources/v1/VulnerabilityResourceTest.java b/src/test/java/org/dependencytrack/resources/v1/VulnerabilityResourceTest.java index 9f6d4415c..6d19151ff 100644 --- a/src/test/java/org/dependencytrack/resources/v1/VulnerabilityResourceTest.java +++ b/src/test/java/org/dependencytrack/resources/v1/VulnerabilityResourceTest.java @@ -657,30 +657,6 @@ public void createVulnerabilityWithBadOwaspVectorTest() { Assert.assertEquals("Provided vector SL:1/M:1/O:a/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 does not match OWASP RR Vector pattern SL:\\d/M:\\d/O:\\d/S:\\d/ED:\\d/EE:\\d/A:\\d/ID:\\d/LC:\\d/LI:\\d/LAV:\\d/LAC:\\d/FD:\\d/RD:\\d/NC:\\d/PV:\\d", body); } - /** - * Ensure that pre-v4.5.0 behavior of setting CWE via a single object - * still works, and both "cwe" and "cwes" fields are returned in the response. - */ - @Test - public void createVulnerabilityCwePreV450CompatTest() { - JsonObject payload = Json.createObjectBuilder() - .add("vulnId", "ACME-1") - .add("cwes", Json.createArrayBuilder().add(Json.createObjectBuilder().add("cweId", 80))) - .build(); - Response response = jersey.target(V1_VULNERABILITY).request() - .header(X_API_KEY, apiKey) - .put(Entity.json(payload.toString())); - Assert.assertEquals(201, response.getStatus(), 0); - JsonObject json = parseJsonObject(response); - Assert.assertNotNull(json); - Assert.assertEquals("ACME-1", json.getString("vulnId")); - Assert.assertEquals("INTERNAL", json.getString("source")); - 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")); - Assert.assertTrue(UuidUtil.isValidUUID(json.getString("uuid"))); - } - @Test public void createVulnerabilityDuplicateTest() { Vulnerability vuln = new Vulnerability();