diff --git a/test/VulnerabilitySpec.scala b/test/VulnerabilitySpec.scala index 33b2799..73078b2 100644 --- a/test/VulnerabilitySpec.scala +++ b/test/VulnerabilitySpec.scala @@ -10,6 +10,12 @@ class VulnerabilitySpec extends Specification { VulnerableSoftware(allPreviousVersion = false, "cpe:/a:asd:asd:1.0") ), Seq()) + val nonCpeVuln = Vulnerability("some-vuln", None, CvssRating(None, None, None, None, None, None, None), "descr", Seq( + VulnerableSoftware(allPreviousVersion = false, "cpex:/a:ftp:ftp"), + VulnerableSoftware(allPreviousVersion = false, "cpex:/a:ssh:ssh:1.0"), + VulnerableSoftware(allPreviousVersion = false, "cpex:/a:asd:asd:1.0") + ), Seq()) + def id(name: String) = Identifier(name = name, confidence = Confidence.Highest, url = "", identifierType = "cpe") @@ -32,6 +38,9 @@ class VulnerabilitySpec extends Specification { "when it matches without version, but it also matches with version and everything matches" >> { vuln.likelyMatchesOnlyWithoutVersion(Set(id("cpe:/a:ftp:ftp:1.0"), id("cpe:/a:ssh:ssh:1.0"), id("cpe:/a:asd:asd:1.0"))) should beFalse } + "for non-CPE identifiers, as they are not supported" >> { + nonCpeVuln.likelyMatchesOnlyWithoutVersion(Set(id("cpe:/a:ftp:ftp:1.0"))) should beFalse + } } // TODO: Add tests for version matching; They would not pass now, though. }