Avoid JsonParser load (just a test) (#3303)

* Fix #3268 - Avoid JsonParser load (just a test)

* Clean up tests

* Bump core version

* Test fix

* Bump
This commit is contained in:
James Agnew 2022-01-21 19:24:20 -05:00 committed by GitHub
parent ab22fd6e82
commit 3ab59f2e34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 4 deletions

View File

@ -62,6 +62,7 @@ import org.hl7.fhir.r4.model.ValueSet;
import org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent;
import org.hl7.fhir.r4.terminologies.ValueSetExpander;
import org.hl7.fhir.r4.utils.FHIRPathEngine;
import org.hl7.fhir.r5.test.utils.ClassesLoadedFlags;
import org.hl7.fhir.r5.utils.validation.IValidationPolicyAdvisor;
import org.hl7.fhir.r5.utils.validation.IValidatorResourceFetcher;
import org.hl7.fhir.r5.utils.validation.constants.BestPracticeWarningLevel;
@ -74,12 +75,11 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.mockito.MockingDetails;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@ -101,6 +101,7 @@ import static org.hamcrest.Matchers.not;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.nullable;
@ -1567,8 +1568,26 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
}
}
@AfterAll
public static void afterClassClearContext() {
public static void verifyFormatParsersNotLoaded() throws Exception {
/*
* If this fails, it means we're classloading the
* generated XmlParser/JsonParser classes, which are
* huge and unnecessary.
*
* To figure out why, put a breakpoint
* in the static method in the class
* org.hl7.fhir.r5.formats.XmlParser
* and then re-run the test.
*/
assertFalse(ClassesLoadedFlags.ourJsonParserBaseLoaded);
assertFalse(ClassesLoadedFlags.ourXmlParserBaseLoaded);
}
@AfterAll
public static void afterClassClearContext() throws IOException, NoSuchFieldException {
myDefaultValidationSupport.flush();
myDefaultValidationSupport = null;
TestUtil.randomizeLocaleAndTimezone();

View File

@ -766,7 +766,7 @@
<properties>
<fhir_core_version>5.6.21</fhir_core_version>
<fhir_core_version>5.6.27</fhir_core_version>
<ucum_version>1.0.3</ucum_version>
<surefire_jvm_args>-Dfile.encoding=UTF-8 -Xmx2048m</surefire_jvm_args>