From 691ad7a20f9d0490550e9d65f1a5861df4091508 Mon Sep 17 00:00:00 2001 From: Justin Chen <62852410+jchen8460@users.noreply.github.com> Date: Wed, 8 Jun 2022 05:42:59 -0700 Subject: [PATCH] Address Non-Deterministic Behavior in Unit Test (#823) * fix unit test --- .../VulnerabilitiesFromOwaspDependencyCheckTest.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/test/java/com/sap/oss/phosphor/fosstars/data/artifact/VulnerabilitiesFromOwaspDependencyCheckTest.java b/src/test/java/com/sap/oss/phosphor/fosstars/data/artifact/VulnerabilitiesFromOwaspDependencyCheckTest.java index caffe1944..9c12faeb4 100644 --- a/src/test/java/com/sap/oss/phosphor/fosstars/data/artifact/VulnerabilitiesFromOwaspDependencyCheckTest.java +++ b/src/test/java/com/sap/oss/phosphor/fosstars/data/artifact/VulnerabilitiesFromOwaspDependencyCheckTest.java @@ -11,7 +11,6 @@ import com.sap.oss.phosphor.fosstars.model.subject.oss.MavenArtifact; import com.sap.oss.phosphor.fosstars.model.value.ValueHashSet; import com.sap.oss.phosphor.fosstars.model.value.Vulnerabilities; -import com.sap.oss.phosphor.fosstars.model.value.Vulnerability; import com.sap.oss.phosphor.fosstars.util.Json; import java.io.File; import java.io.IOException; @@ -49,8 +48,8 @@ public void testVulnerabilitiesAvailable() throws IOException { Vulnerabilities vulnerabilities = values.of(VULNERABILITIES_IN_ARTIFACT).get().get(); assertEquals(3, vulnerabilities.size()); - Vulnerability vulnerability = vulnerabilities.entries().iterator().next(); - assertEquals("CVE-2018-11307", vulnerability.id()); + assertTrue(vulnerabilities.entries().stream() + .anyMatch(vulnerability -> "CVE-2018-11307".equals(vulnerability.id()))); } @Test