Skip to content

Commit

Permalink
Add negative case when testing property matching
Browse files Browse the repository at this point in the history
  • Loading branch information
abn committed Oct 26, 2014
1 parent 09e0cc0 commit 05ab2ae
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/test/java/com/redhat/victims/VictimsDatabaseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;

import org.apache.commons.io.FileUtils;
Expand Down Expand Up @@ -67,7 +68,12 @@ private void testVulnerabilities(VictimsDBInterface vdb, boolean embedded, boole
HashSet<String> result;

if (meta) {
result = vdb.getVulnerabilities(vr.getFlattenedMetaData());
HashMap<String, String> metadata = vr.getFlattenedMetaData();
result = vdb.getVulnerabilities(metadata);
for (String key : metadata.keySet()) {
metadata.put(key, "THISREALLYSHOULDNOTEXIST");
}
assertEquals("Negative case for property match failed.", 0, vdb.getVulnerabilities(metadata).size());
} else {
vr.hash = "0";
if (embedded) {
Expand Down

0 comments on commit 05ab2ae

Please sign in to comment.