Skip to content

Commit

Permalink
Fix unit test loading modules from jar.
Browse files Browse the repository at this point in the history
  • Loading branch information
jawalonoski committed May 20, 2024
1 parent 025e0f0 commit e2cee7a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/test/java/org/mitre/synthea/engine/ModuleTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.stream.JsonReader;
import java.io.File;

import java.io.FileReader;
import java.io.File;
import java.io.IOException;
import java.io.StringReader;
import java.lang.reflect.Field;
import java.nio.file.Files;
import java.nio.file.Paths;
Expand Down Expand Up @@ -291,9 +291,12 @@ public interface FaultyModuleScope extends AutoCloseable {
public void targetEncounters() throws Exception {
Utilities.walkAllModules((modulesFolder, t) -> {
try {
FileReader fileReader = new FileReader(t.toString());
JsonReader reader = new JsonReader(fileReader);
System.out.format("Loading %s\n", t.toString());
String moduleRelativePath = modulesFolder.getParent().relativize(t).toString();
JsonReader reader = new JsonReader(new StringReader(
Utilities.readResourceOrPath(moduleRelativePath)));
JsonObject object = JsonParser.parseReader(reader).getAsJsonObject();
reader.close();
JsonObject states = object.getAsJsonObject("states");
for (String stateName : states.keySet()) {
JsonObject state = states.getAsJsonObject(stateName);
Expand Down

0 comments on commit e2cee7a

Please sign in to comment.