Skip to content

Commit

Permalink
added mandatory keys in test
Browse files Browse the repository at this point in the history
  • Loading branch information
mattebit committed Oct 19, 2023
1 parent 75eb2ca commit 86620b3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tool/src/main/java/migt/Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public class Test {
// Infos
String name;
String description;
List<String> mandatory_keys = new ArrayList<>();

/**
* Empty constructor for tests
Expand All @@ -58,6 +59,13 @@ public Test(JSONObject test_json,
setType(test_json.getString("type"));

Iterator<String> keys = test_json.keys();

for (String k : mandatory_keys) {
if (!test_json.keySet().contains(k)) {
throw new ParsingException("Test is missing required \"" + k + "\" key");
}
}

while (keys.hasNext()) {
String key = keys.next();

Expand Down Expand Up @@ -144,6 +152,11 @@ public void init() {
references = "";
violated_properties = "";
mitigations = "";

mandatory_keys.add("result");
mandatory_keys.add("name");
mandatory_keys.add("type");
mandatory_keys.add("sessions");
}

public String getName() {
Expand Down

0 comments on commit 86620b3

Please sign in to comment.