Fix timezone issue in PE tests

This commit is contained in:
Grahame Grieve 2023-09-27 09:06:04 +10:00
parent 24905a2c16
commit 79b45832e4
3 changed files with 15 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import org.hl7.fhir.utilities.validation.ValidationMessage;
public class ValidatedFragment {
private String name;
private String elementPath;
private String extension;
private Element element;
private byte[] content;
@ -51,4 +52,15 @@ public class ValidatedFragment {
return name+"."+extension;
}
public String getElementPath() {
return elementPath;
}
public void setElementPath(String elementPath) {
this.elementPath = elementPath;
}
public String path() {
return elementPath == null ? name : elementPath;
}
}

View File

@ -6,6 +6,7 @@ import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.context.IWorkerContext;
@ -48,6 +49,7 @@ public class GeneratedPEModelTest {
@Test
public void testPEGenLoad() throws Exception {
TimeZone.setDefault(TimeZone.getTimeZone("UTC+1100"));
load();
Observation obs = (Observation) new XmlParser().parse(TestingUtilities.loadTestResourceStream("r5", "profiles", "pe-instance.xml"));
TestProfile tp = TestProfile.fromSource(ctxt, obs);

View File

@ -766,7 +766,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
}
for (ValidatedFragment ne : validatedContent) {
if (ne.getElement() != null) {
validate(appContext, ne.getErrors(), validatedContent.size() > 1 ? ne.getName() : null, ne.getElement(), profiles);
validate(appContext, ne.getErrors(), validatedContent.size() > 1 ? ne.path() : null, ne.getElement(), profiles);
}
errors.addAll(ne.getErrors());
}