diff --git a/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/client/GenericClientDstu3IT.java b/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/client/GenericClientDstu3IT.java index 77b6e8a949a..1423d7f4681 100644 --- a/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/client/GenericClientDstu3IT.java +++ b/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/client/GenericClientDstu3IT.java @@ -1,34 +1,50 @@ package ca.uhn.fhir.android.client; -import static org.junit.jupiter.api.Assertions.*; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.util.Date; - -import ca.uhn.fhir.rest.api.EncodingEnum; -import ca.uhn.fhir.rest.api.PreferReturnEnum; -import org.hl7.fhir.dstu3.model.*; -import org.junit.jupiter.api.*; import static org.hamcrest.MatcherAssert.assertThat; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; - import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.parser.IParser; import ca.uhn.fhir.rest.api.Constants; +import ca.uhn.fhir.rest.api.EncodingEnum; import ca.uhn.fhir.rest.api.MethodOutcome; +import ca.uhn.fhir.rest.api.PreferReturnEnum; import ca.uhn.fhir.rest.client.api.IGenericClient; import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum; import ca.uhn.fhir.rest.client.exceptions.FhirClientConnectionException; import ca.uhn.fhir.util.TestUtil; import ca.uhn.fhir.util.VersionUtil; -import okhttp3.*; +import okhttp3.Call; +import okhttp3.Headers; +import okhttp3.MediaType; +import okhttp3.Protocol; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; import okio.Buffer; +import org.hl7.fhir.dstu3.model.Binary; +import org.hl7.fhir.dstu3.model.Bundle; +import org.hl7.fhir.dstu3.model.OperationOutcome; +import org.hl7.fhir.dstu3.model.Patient; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.Date; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.fail; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; public class GenericClientDstu3IT { @@ -280,7 +296,7 @@ public class GenericClientDstu3IT { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/TestUtil.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/TestUtil.java index 936ed1fc12b..66a2f47cd96 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/TestUtil.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/TestUtil.java @@ -20,16 +20,8 @@ package ca.uhn.fhir.util; * #L% */ -import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.i18n.HapiLocalizer; -import ch.qos.logback.classic.Level; -import ch.qos.logback.classic.Logger; -import ch.qos.logback.classic.LoggerContext; -import org.slf4j.LoggerFactory; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.util.Arrays; import java.util.Locale; import java.util.TimeZone; import java.util.concurrent.Callable; @@ -52,58 +44,10 @@ public class TestUtil { * tons of memory being used by the end and the JVM crashes in Travis. Manually clearing all of the * static fields seems to solve this. */ - public static void clearAllStaticFieldsForUnitTest() { + public static void randomizeLocaleAndTimezone() { HapiLocalizer.setOurFailOnMissingMessage(true); - Class theType; - try { - throw new Exception(); - } catch (Exception e) { - StackTraceElement[] st = e.getStackTrace(); - StackTraceElement elem = st[1]; - String clazzName = elem.getClassName(); - try { - theType = Class.forName(clazzName); - } catch (ClassNotFoundException e1) { - throw new Error(e); - } - } - - for (Field next : Arrays.asList(theType.getDeclaredFields())) { - if (Modifier.isStatic(next.getModifiers())) { - if (!Modifier.isFinal(next.getModifiers()) && !next.getType().isPrimitive()) { - ourLog.info("Clearing value of field: {}", next.toString()); - try { - next.setAccessible(true); - next.set(theType, null); - } catch (Exception e) { - throw new Error(e); - } - } - if (Modifier.isFinal(next.getModifiers())) { - if (next.getType().equals(FhirContext.class)) { - throw new Error("Test has final field of type FhirContext: " + next); - } - } - } - - } - - randomizeLocale(); - - /* - * If we're running a CI build, set all loggers to TRACE level to ensure coverage - * on trace blocks - */ - try { - if ("true".equals(System.getProperty("ci"))) { - for (Logger next : ((LoggerContext) LoggerFactory.getILoggerFactory()).getLoggerList()) { - next.setLevel(Level.TRACE); - } - } - } catch (NoClassDefFoundError e) { - // ignore - } + doRandomizeLocaleAndTimezone(); } /** @@ -111,7 +55,7 @@ public class TestUtil { * but it helps us make sure we don't have any tests that depend on a particular * environment */ - public static void randomizeLocale() { + public static void doRandomizeLocaleAndTimezone() { // Locale[] availableLocales = {Locale.CANADA, Locale.GERMANY, Locale.TAIWAN}; Locale[] availableLocales = {Locale.US}; Locale.setDefault(availableLocales[(int) (Math.random() * availableLocales.length)]); diff --git a/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/api/QualifiedParamListTest.java b/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/api/QualifiedParamListTest.java index a0018aead2d..a5d36d28fb5 100644 --- a/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/api/QualifiedParamListTest.java +++ b/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/api/QualifiedParamListTest.java @@ -37,7 +37,7 @@ public class QualifiedParamListTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/src/test/java/ca/uhn/fhir/cli/ExportConceptMapToCsvCommandDstu3Test.java b/hapi-fhir-cli/hapi-fhir-cli-api/src/test/java/ca/uhn/fhir/cli/ExportConceptMapToCsvCommandDstu3Test.java index 80e89fa2257..55acf246fc0 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-api/src/test/java/ca/uhn/fhir/cli/ExportConceptMapToCsvCommandDstu3Test.java +++ b/hapi-fhir-cli/hapi-fhir-cli-api/src/test/java/ca/uhn/fhir/cli/ExportConceptMapToCsvCommandDstu3Test.java @@ -88,7 +88,7 @@ public class ExportConceptMapToCsvCommandDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/src/test/java/ca/uhn/fhir/cli/ExportConceptMapToCsvCommandR4Test.java b/hapi-fhir-cli/hapi-fhir-cli-api/src/test/java/ca/uhn/fhir/cli/ExportConceptMapToCsvCommandR4Test.java index 9ff9b85a5d7..ad84ad6b229 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-api/src/test/java/ca/uhn/fhir/cli/ExportConceptMapToCsvCommandR4Test.java +++ b/hapi-fhir-cli/hapi-fhir-cli-api/src/test/java/ca/uhn/fhir/cli/ExportConceptMapToCsvCommandR4Test.java @@ -81,7 +81,7 @@ public class ExportConceptMapToCsvCommandR4Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/src/test/java/ca/uhn/fhir/cli/ImportCsvToConceptMapCommandDstu3Test.java b/hapi-fhir-cli/hapi-fhir-cli-api/src/test/java/ca/uhn/fhir/cli/ImportCsvToConceptMapCommandDstu3Test.java index dcf23514bb8..5b0b3bd3b9e 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-api/src/test/java/ca/uhn/fhir/cli/ImportCsvToConceptMapCommandDstu3Test.java +++ b/hapi-fhir-cli/hapi-fhir-cli-api/src/test/java/ca/uhn/fhir/cli/ImportCsvToConceptMapCommandDstu3Test.java @@ -341,7 +341,7 @@ public class ImportCsvToConceptMapCommandDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/src/test/java/ca/uhn/fhir/cli/ImportCsvToConceptMapCommandR4Test.java b/hapi-fhir-cli/hapi-fhir-cli-api/src/test/java/ca/uhn/fhir/cli/ImportCsvToConceptMapCommandR4Test.java index f59028a98f7..f859fb4c638 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-api/src/test/java/ca/uhn/fhir/cli/ImportCsvToConceptMapCommandR4Test.java +++ b/hapi-fhir-cli/hapi-fhir-cli-api/src/test/java/ca/uhn/fhir/cli/ImportCsvToConceptMapCommandR4Test.java @@ -422,7 +422,7 @@ public class ImportCsvToConceptMapCommandR4Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-converter/src/test/java/ca/uhn/hapi/converters/server/VersionedApiConverterInterceptorR4Test.java b/hapi-fhir-converter/src/test/java/ca/uhn/hapi/converters/server/VersionedApiConverterInterceptorR4Test.java index 02e68aeafa1..08e6f17231c 100644 --- a/hapi-fhir-converter/src/test/java/ca/uhn/hapi/converters/server/VersionedApiConverterInterceptorR4Test.java +++ b/hapi-fhir-converter/src/test/java/ca/uhn/hapi/converters/server/VersionedApiConverterInterceptorR4Test.java @@ -76,7 +76,7 @@ public class VersionedApiConverterInterceptorR4Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderDstu3Test.java b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderDstu3Test.java index d3c0497dc6f..497a458c860 100644 --- a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderDstu3Test.java +++ b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderDstu3Test.java @@ -23,8 +23,17 @@ import org.apache.commons.lang3.StringUtils; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; -import org.hl7.fhir.dstu3.model.*; +import org.hl7.fhir.dstu3.model.Bundle; import org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent; +import org.hl7.fhir.dstu3.model.CapabilityStatement; +import org.hl7.fhir.dstu3.model.DateType; +import org.hl7.fhir.dstu3.model.IdType; +import org.hl7.fhir.dstu3.model.Identifier; +import org.hl7.fhir.dstu3.model.OperationOutcome; +import org.hl7.fhir.dstu3.model.Parameters; +import org.hl7.fhir.dstu3.model.Patient; +import org.hl7.fhir.dstu3.model.Resource; +import org.hl7.fhir.dstu3.model.StringType; import org.hl7.fhir.instance.model.api.IBaseOperationOutcome; import org.hl7.fhir.instance.model.api.IBaseResource; import org.junit.jupiter.api.AfterAll; @@ -81,7 +90,7 @@ public class AbstractJaxRsResourceProviderDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(jettyServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } private void compareResultUrl(String url, IBaseResource resource) { diff --git a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderTest.java b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderTest.java index 954d3c2c650..d852ac00dd7 100644 --- a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderTest.java +++ b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderTest.java @@ -90,7 +90,7 @@ public class AbstractJaxRsResourceProviderTest { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(jettyServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } private Patient createPatient(long id) { diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java index 3a33c57abdd..fb2e49f1d1c 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java @@ -103,7 +103,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.stream.Collectors; import java.util.stream.Stream; -import static ca.uhn.fhir.util.TestUtil.randomizeLocale; +import static ca.uhn.fhir.util.TestUtil.doRandomizeLocaleAndTimezone; import static org.awaitility.Awaitility.await; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; @@ -601,7 +601,7 @@ public abstract class BaseJpaTest extends BaseTest { @BeforeAll public static void beforeClassRandomizeLocale() { - randomizeLocale(); + doRandomizeLocaleAndTimezone(); } @AfterAll diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseR4SearchLastN.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseR4SearchLastN.java index 682e7283623..c0d6b09c2a4 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseR4SearchLastN.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseR4SearchLastN.java @@ -593,7 +593,7 @@ public class BaseR4SearchLastN extends BaseJpaTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4TerminologyElasticsearchIT.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4TerminologyElasticsearchIT.java index f8d511fa2be..6cc0a2feb59 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4TerminologyElasticsearchIT.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4TerminologyElasticsearchIT.java @@ -14,10 +14,10 @@ import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion; import ca.uhn.fhir.jpa.entity.TermConcept; import ca.uhn.fhir.jpa.model.entity.ResourceTable; import ca.uhn.fhir.jpa.search.reindex.IResourceReindexingSvc; -import ca.uhn.fhir.rest.server.util.ISearchParamRegistry; import ca.uhn.fhir.jpa.term.api.ITermCodeSystemStorageSvc; import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails; +import ca.uhn.fhir.rest.server.util.ISearchParamRegistry; import ca.uhn.fhir.test.utilities.docker.RequiresDocker; import ca.uhn.fhir.util.TestUtil; import org.hl7.fhir.instance.model.api.IIdType; @@ -162,7 +162,7 @@ public class FhirResourceDaoR4TerminologyElasticsearchIT extends BaseJpaTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-jpaserver-model/src/test/java/ca/uhn/fhir/jpa/model/entity/TagTypeEnumTest.java b/hapi-fhir-jpaserver-model/src/test/java/ca/uhn/fhir/jpa/model/entity/TagTypeEnumTest.java index 011b8e47c31..b844cb3b689 100644 --- a/hapi-fhir-jpaserver-model/src/test/java/ca/uhn/fhir/jpa/model/entity/TagTypeEnumTest.java +++ b/hapi-fhir-jpaserver-model/src/test/java/ca/uhn/fhir/jpa/model/entity/TagTypeEnumTest.java @@ -10,7 +10,7 @@ public class TagTypeEnumTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorDstu3Test.java b/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorDstu3Test.java index 5e70f8f7fe2..3aa66385d1a 100644 --- a/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorDstu3Test.java +++ b/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorDstu3Test.java @@ -296,7 +296,7 @@ public class SearchParamExtractorDstu3Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/model/IdTypeDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/model/IdTypeDstu2_1Test.java index 9587488417f..50b753fec25 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/model/IdTypeDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/model/IdTypeDstu2_1Test.java @@ -24,7 +24,7 @@ public class IdTypeDstu2_1Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @Test diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/model/ModelDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/model/ModelDstu2_1Test.java index f35f4e652cb..8377b01ffe9 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/model/ModelDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/model/ModelDstu2_1Test.java @@ -46,7 +46,7 @@ public class ModelDstu2_1Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/model/ModelSerializationDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/model/ModelSerializationDstu2_1Test.java index dea466ae614..50d3ece4f33 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/model/ModelSerializationDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/model/ModelSerializationDstu2_1Test.java @@ -36,7 +36,7 @@ public class ModelSerializationDstu2_1Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/parser/CustomTypeDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/parser/CustomTypeDstu2_1Test.java index 5c649639273..02a3acbc669 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/parser/CustomTypeDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/parser/CustomTypeDstu2_1Test.java @@ -19,9 +19,9 @@ import org.hl7.fhir.dstu2016may.model.Patient; import org.hl7.fhir.dstu2016may.model.Quantity; import org.hl7.fhir.dstu2016may.model.StringType; import org.hl7.fhir.instance.model.api.IBase; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.List; @@ -45,7 +45,7 @@ public class CustomTypeDstu2_1Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/parser/EmptyElementWithExtensionDstu3Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/parser/EmptyElementWithExtensionDstu3Test.java index 1d28391f724..374fece7c8d 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/parser/EmptyElementWithExtensionDstu3Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/parser/EmptyElementWithExtensionDstu3Test.java @@ -22,7 +22,7 @@ public class EmptyElementWithExtensionDstu3Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/parser/JsonParserDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/parser/JsonParserDstu2_1Test.java index dfb209b95a1..3adaa2c9d56 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/parser/JsonParserDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/parser/JsonParserDstu2_1Test.java @@ -1874,6 +1874,6 @@ public class JsonParserDstu2_1Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/parser/XmlParserDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/parser/XmlParserDstu2_1Test.java index af9bd268f71..7854c55d2c0 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/parser/XmlParserDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/parser/XmlParserDstu2_1Test.java @@ -15,17 +15,48 @@ import org.hamcrest.collection.IsEmptyCollection; import org.hamcrest.core.StringContains; import org.hamcrest.text.StringContainsInOrder; import org.hl7.fhir.dstu2016may.model.Address.AddressUse; -import org.hl7.fhir.dstu2016may.model.*; +import org.hl7.fhir.dstu2016may.model.Appointment; +import org.hl7.fhir.dstu2016may.model.AuditEvent; +import org.hl7.fhir.dstu2016may.model.Binary; +import org.hl7.fhir.dstu2016may.model.Bundle; import org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent; import org.hl7.fhir.dstu2016may.model.Bundle.BundleType; +import org.hl7.fhir.dstu2016may.model.CodeType; +import org.hl7.fhir.dstu2016may.model.CodeableConcept; +import org.hl7.fhir.dstu2016may.model.Coding; +import org.hl7.fhir.dstu2016may.model.Condition; import org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem; +import org.hl7.fhir.dstu2016may.model.DateTimeType; +import org.hl7.fhir.dstu2016may.model.DateType; +import org.hl7.fhir.dstu2016may.model.DiagnosticReport; import org.hl7.fhir.dstu2016may.model.DiagnosticReport.DiagnosticReportStatus; +import org.hl7.fhir.dstu2016may.model.DocumentManifest; +import org.hl7.fhir.dstu2016may.model.Duration; +import org.hl7.fhir.dstu2016may.model.Encounter; import org.hl7.fhir.dstu2016may.model.Enumerations.AdministrativeGender; import org.hl7.fhir.dstu2016may.model.Enumerations.DocumentReferenceStatus; +import org.hl7.fhir.dstu2016may.model.Extension; +import org.hl7.fhir.dstu2016may.model.HumanName; import org.hl7.fhir.dstu2016may.model.HumanName.NameUse; +import org.hl7.fhir.dstu2016may.model.IdType; +import org.hl7.fhir.dstu2016may.model.Identifier; import org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse; +import org.hl7.fhir.dstu2016may.model.InstantType; +import org.hl7.fhir.dstu2016may.model.Location; +import org.hl7.fhir.dstu2016may.model.Medication; +import org.hl7.fhir.dstu2016may.model.MedicationOrder; +import org.hl7.fhir.dstu2016may.model.Observation; import org.hl7.fhir.dstu2016may.model.Observation.ObservationRelationshipType; import org.hl7.fhir.dstu2016may.model.Observation.ObservationStatus; +import org.hl7.fhir.dstu2016may.model.Organization; +import org.hl7.fhir.dstu2016may.model.Patient; +import org.hl7.fhir.dstu2016may.model.PrimitiveType; +import org.hl7.fhir.dstu2016may.model.Quantity; +import org.hl7.fhir.dstu2016may.model.Reference; +import org.hl7.fhir.dstu2016may.model.Resource; +import org.hl7.fhir.dstu2016may.model.SampledData; +import org.hl7.fhir.dstu2016may.model.SimpleQuantity; +import org.hl7.fhir.dstu2016may.model.StringType; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IIdType; import org.junit.jupiter.api.AfterAll; @@ -2577,7 +2608,7 @@ public class XmlParserDstu2_1Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } public static void compareXml(String content, String reEncoded) { diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationDstu2_1Test.java index 2492da0076e..8137f604b77 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationDstu2_1Test.java @@ -144,7 +144,7 @@ public class ClientServerValidationDstu2_1Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/ClientWithCustomTypeDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/ClientWithCustomTypeDstu2_1Test.java index 77a3e217121..1abc8072a14 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/ClientWithCustomTypeDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/ClientWithCustomTypeDstu2_1Test.java @@ -15,10 +15,10 @@ import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.message.BasicHeader; import org.apache.http.message.BasicStatusLine; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; import org.mockito.invocation.InvocationOnMock; @@ -40,7 +40,7 @@ public class ClientWithCustomTypeDstu2_1Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu2_1Test.java index cc5676ce0b1..9b71104f678 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu2_1Test.java @@ -38,13 +38,22 @@ import org.apache.http.client.methods.HttpPut; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.message.BasicHeader; import org.apache.http.message.BasicStatusLine; -import org.hl7.fhir.dstu2016may.model.*; +import org.hl7.fhir.dstu2016may.model.Binary; +import org.hl7.fhir.dstu2016may.model.Bundle; import org.hl7.fhir.dstu2016may.model.Bundle.BundleType; +import org.hl7.fhir.dstu2016may.model.Conformance; +import org.hl7.fhir.dstu2016may.model.Device; +import org.hl7.fhir.dstu2016may.model.Encounter; +import org.hl7.fhir.dstu2016may.model.IdType; +import org.hl7.fhir.dstu2016may.model.Observation; +import org.hl7.fhir.dstu2016may.model.OperationOutcome; +import org.hl7.fhir.dstu2016may.model.Parameters; +import org.hl7.fhir.dstu2016may.model.Patient; import org.hl7.fhir.instance.model.api.IBaseResource; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; import org.mockito.invocation.InvocationOnMock; @@ -53,7 +62,6 @@ import org.mockito.stubbing.Answer; import java.io.IOException; import java.io.InputStream; import java.io.StringReader; -import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; @@ -1995,7 +2003,7 @@ public class GenericClientDstu2_1Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/NonGenericClientDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/NonGenericClientDstu2_1Test.java index d1b41cfe4c2..d88582b7086 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/NonGenericClientDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/NonGenericClientDstu2_1Test.java @@ -28,10 +28,10 @@ import org.hl7.fhir.dstu2016may.model.IdType; import org.hl7.fhir.dstu2016may.model.OperationOutcome; import org.hl7.fhir.dstu2016may.model.Patient; import org.hl7.fhir.instance.model.api.IBaseResource; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; import org.mockito.invocation.InvocationOnMock; @@ -167,7 +167,7 @@ public class NonGenericClientDstu2_1Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/OperationClientDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/OperationClientDstu2_1Test.java index 202a1e218d1..0989cf28bf8 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/OperationClientDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/OperationClientDstu2_1Test.java @@ -26,9 +26,9 @@ import org.apache.http.message.BasicHeader; import org.apache.http.message.BasicStatusLine; import org.hl7.fhir.dstu2016may.model.Parameters; import org.hl7.fhir.dstu2016may.model.StringType; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; import org.mockito.invocation.InvocationOnMock; @@ -57,7 +57,7 @@ public class OperationClientDstu2_1Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/PatchClientDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/PatchClientDstu2_1Test.java index 18cd8418932..27a2321f480 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/PatchClientDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/PatchClientDstu2_1Test.java @@ -25,11 +25,11 @@ import org.apache.http.message.BasicStatusLine; import org.hl7.fhir.dstu2016may.model.IdType; import org.hl7.fhir.dstu2016may.model.OperationOutcome; import org.hl7.fhir.dstu2016may.model.Patient; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; import org.mockito.invocation.InvocationOnMock; @@ -129,7 +129,7 @@ public class PatchClientDstu2_1Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/SearchClientDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/SearchClientDstu2_1Test.java index c693a2f366d..1fe8e8e0e68 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/SearchClientDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/SearchClientDstu2_1Test.java @@ -27,9 +27,9 @@ import org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent; import org.hl7.fhir.dstu2016may.model.Extension; import org.hl7.fhir.dstu2016may.model.Location; import org.hl7.fhir.dstu2016may.model.StringType; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; import org.mockito.invocation.InvocationOnMock; @@ -57,7 +57,7 @@ public class SearchClientDstu2_1Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeEach diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/CreateBinaryDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/CreateBinaryDstu2_1Test.java index 065514500c4..d8b81a61e16 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/CreateBinaryDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/CreateBinaryDstu2_1Test.java @@ -22,10 +22,10 @@ import org.hl7.fhir.dstu2016may.model.Binary; import org.hl7.fhir.dstu2016may.model.IdType; import org.hl7.fhir.dstu2016may.model.Patient; import org.hl7.fhir.instance.model.api.IBaseResource; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.util.concurrent.TimeUnit; @@ -128,7 +128,7 @@ public class CreateBinaryDstu2_1Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/CreateDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/CreateDstu2_1Test.java index 8ac0cf3900e..652cd19fe0b 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/CreateDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/CreateDstu2_1Test.java @@ -212,7 +212,7 @@ public class CreateDstu2_1Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/CustomTypeServerDstu2_1.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/CustomTypeServerDstu2_1.java index 962a71b11f3..bc39778fe31 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/CustomTypeServerDstu2_1.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/CustomTypeServerDstu2_1.java @@ -27,10 +27,10 @@ import org.eclipse.jetty.servlet.ServletHolder; import org.hl7.fhir.dstu2016may.model.IdType; import org.hl7.fhir.dstu2016may.model.OperationOutcome; import org.hl7.fhir.dstu2016may.model.Patient; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.nio.charset.StandardCharsets; import java.util.ArrayList; @@ -129,7 +129,7 @@ public class CustomTypeServerDstu2_1 { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/DeleteConditionalDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/DeleteConditionalDstu2_1Test.java index 2f52b30c727..ad7fe63c5a3 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/DeleteConditionalDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/DeleteConditionalDstu2_1Test.java @@ -18,10 +18,10 @@ import org.eclipse.jetty.servlet.ServletHolder; import org.hl7.fhir.dstu2016may.model.IdType; import org.hl7.fhir.dstu2016may.model.Patient; import org.hl7.fhir.instance.model.api.IBaseResource; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.util.concurrent.TimeUnit; @@ -83,7 +83,7 @@ public class DeleteConditionalDstu2_1Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/FormatParameterDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/FormatParameterDstu2_1Test.java index 582e27c51f3..e5c7478ec9d 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/FormatParameterDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/FormatParameterDstu2_1Test.java @@ -18,9 +18,9 @@ import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.hl7.fhir.dstu2016may.model.IdType; import org.hl7.fhir.dstu2016may.model.Patient; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import java.util.concurrent.TimeUnit; @@ -202,7 +202,7 @@ public class FormatParameterDstu2_1Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/MetadataConformanceDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/MetadataConformanceDstu2_1Test.java index 3f3c53b543f..b2d8553b8f2 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/MetadataConformanceDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/MetadataConformanceDstu2_1Test.java @@ -1,7 +1,6 @@ package ca.uhn.fhir.rest.server; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.rest.annotation.OptionalParam; import ca.uhn.fhir.rest.annotation.ResourceParam; import ca.uhn.fhir.rest.annotation.Search; @@ -143,7 +142,7 @@ public class MetadataConformanceDstu2_1Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/OperationServerDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/OperationServerDstu2_1Test.java index 93970cb0ca7..c877b191011 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/OperationServerDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/OperationServerDstu2_1Test.java @@ -1,22 +1,22 @@ package ca.uhn.fhir.rest.server; -import static org.hamcrest.Matchers.containsInRelativeOrder; -import static org.hamcrest.Matchers.containsString; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.Matchers.startsWith; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.hamcrest.MatcherAssert.assertThat; - -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.TimeUnit; - +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.rest.annotation.IdParam; +import ca.uhn.fhir.rest.annotation.Operation; +import ca.uhn.fhir.rest.annotation.OperationParam; +import ca.uhn.fhir.rest.annotation.Read; +import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.EncodingEnum; +import ca.uhn.fhir.rest.api.server.IBundleProvider; +import ca.uhn.fhir.rest.client.api.IGenericClient; +import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor; +import ca.uhn.fhir.test.utilities.JettyUtil; +import ca.uhn.fhir.util.TestUtil; import org.apache.commons.io.IOUtils; import org.apache.http.HttpResponse; -import org.apache.http.client.methods.*; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; @@ -25,23 +25,37 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletHolder; -import org.hl7.fhir.dstu2016may.model.*; +import org.hl7.fhir.dstu2016may.model.Bundle; +import org.hl7.fhir.dstu2016may.model.Conformance; import org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent; +import org.hl7.fhir.dstu2016may.model.DateTimeType; +import org.hl7.fhir.dstu2016may.model.IdType; +import org.hl7.fhir.dstu2016may.model.IntegerType; +import org.hl7.fhir.dstu2016may.model.Money; +import org.hl7.fhir.dstu2016may.model.OperationDefinition; import org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse; +import org.hl7.fhir.dstu2016may.model.Parameters; +import org.hl7.fhir.dstu2016may.model.Patient; +import org.hl7.fhir.dstu2016may.model.StringType; +import org.hl7.fhir.dstu2016may.model.UnsignedIntType; import org.hl7.fhir.instance.model.api.IBaseResource; -import org.junit.jupiter.api.*; import static org.hamcrest.MatcherAssert.assertThat; - -import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.rest.annotation.*; -import ca.uhn.fhir.rest.api.Constants; -import ca.uhn.fhir.rest.api.server.IBundleProvider; -import ca.uhn.fhir.rest.client.api.IGenericClient; -import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor; -import ca.uhn.fhir.test.utilities.JettyUtil; -import ca.uhn.fhir.util.TestUtil; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.TimeUnit; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.containsInRelativeOrder; +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.Matchers.startsWith; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; public class OperationServerDstu2_1Test { private static CloseableHttpClient ourClient; @@ -530,7 +544,7 @@ public class OperationServerDstu2_1Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/OperationServerWithSearchParamTypesDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/OperationServerWithSearchParamTypesDstu2_1Test.java index 63be245658c..d8054c0c07e 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/OperationServerWithSearchParamTypesDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/OperationServerWithSearchParamTypesDstu2_1Test.java @@ -36,10 +36,10 @@ import org.hl7.fhir.dstu2016may.model.Parameters; import org.hl7.fhir.dstu2016may.model.Patient; import org.hl7.fhir.dstu2016may.model.StringType; import org.hl7.fhir.instance.model.api.IBaseResource; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import javax.servlet.ServletConfig; import javax.servlet.http.HttpServletRequest; @@ -387,7 +387,7 @@ public class OperationServerWithSearchParamTypesDstu2_1Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll public static void beforeClass() throws Exception { diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/PatchDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/PatchDstu2_1Test.java index ba4399073af..c82057aa616 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/PatchDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/PatchDstu2_1Test.java @@ -156,7 +156,7 @@ public class PatchDstu2_1Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/ReadDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/ReadDstu2_1Test.java index 3a77526bad6..ef1892e907c 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/ReadDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/ReadDstu2_1Test.java @@ -19,9 +19,9 @@ import org.eclipse.jetty.servlet.ServletHolder; import org.hl7.fhir.dstu2016may.model.DateType; import org.hl7.fhir.dstu2016may.model.IdType; import org.hl7.fhir.dstu2016may.model.Patient; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import java.nio.charset.StandardCharsets; import java.util.concurrent.TimeUnit; @@ -72,7 +72,7 @@ public class ReadDstu2_1Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchCountParamDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchCountParamDstu2_1Test.java index 3a851f8d4a3..126f01451ae 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchCountParamDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchCountParamDstu2_1Test.java @@ -113,7 +113,7 @@ public class SearchCountParamDstu2_1Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchDstu2_1Test.java index f01fdc6f4cf..eaf22e30309 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchDstu2_1Test.java @@ -87,7 +87,7 @@ public class SearchDstu2_1Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchHasParamDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchHasParamDstu2_1Test.java index c00e8cf4e52..fcd300cee41 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchHasParamDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchHasParamDstu2_1Test.java @@ -67,7 +67,7 @@ public class SearchHasParamDstu2_1Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchPostDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchPostDstu2_1Test.java index bf431c3da55..7ab78bee8b9 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchPostDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchPostDstu2_1Test.java @@ -27,10 +27,10 @@ import org.eclipse.jetty.servlet.ServletHolder; import org.hl7.fhir.dstu2016may.model.HumanName; import org.hl7.fhir.dstu2016may.model.Patient; import org.hl7.fhir.instance.model.api.IBaseResource; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -204,7 +204,7 @@ public class SearchPostDstu2_1Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchSortDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchSortDstu2_1Test.java index f851351b16f..2abec3a4fb3 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchSortDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchSortDstu2_1Test.java @@ -77,7 +77,7 @@ public class SearchSortDstu2_1Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchWithGenericListDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchWithGenericListDstu2_1Test.java index 6c6a0c390bf..e565e08a5f0 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchWithGenericListDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchWithGenericListDstu2_1Test.java @@ -66,7 +66,7 @@ public class SearchWithGenericListDstu2_1Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchWithIncludesDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchWithIncludesDstu2_1Test.java index 96659ea45c8..97b88e3bcad 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchWithIncludesDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchWithIncludesDstu2_1Test.java @@ -64,7 +64,7 @@ public class SearchWithIncludesDstu2_1Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchWithServerAddressStrategyDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchWithServerAddressStrategyDstu2_1Test.java index 59545ed6005..d486934fa09 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchWithServerAddressStrategyDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchWithServerAddressStrategyDstu2_1Test.java @@ -119,7 +119,7 @@ public class SearchWithServerAddressStrategyDstu2_1Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/ServerExceptionDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/ServerExceptionDstu2_1Test.java index 7c60b03bc34..ec0f45e8320 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/ServerExceptionDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/ServerExceptionDstu2_1Test.java @@ -93,7 +93,7 @@ public class ServerExceptionDstu2_1Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/ServerMimetypeDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/ServerMimetypeDstu2_1Test.java index d05ff004a33..08854c9b191 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/ServerMimetypeDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/ServerMimetypeDstu2_1Test.java @@ -349,7 +349,7 @@ public class ServerMimetypeDstu2_1Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/ServerUsingOldTypesDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/ServerUsingOldTypesDstu2_1Test.java index 79f625c918e..afe0e9b97e0 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/ServerUsingOldTypesDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/ServerUsingOldTypesDstu2_1Test.java @@ -24,7 +24,7 @@ public class ServerUsingOldTypesDstu2_1Test { private static FhirContext ourCtx = FhirContext.forDstu2_1(); @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @Test diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/UnclassifiedServerExceptionDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/UnclassifiedServerExceptionDstu2_1Test.java index d6e25b3947d..20b571725b5 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/UnclassifiedServerExceptionDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/UnclassifiedServerExceptionDstu2_1Test.java @@ -64,7 +64,7 @@ public class UnclassifiedServerExceptionDstu2_1Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/UpdateDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/UpdateDstu2_1Test.java index 8dcc92bb2da..5066e7bea9b 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/UpdateDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/UpdateDstu2_1Test.java @@ -24,10 +24,10 @@ import org.eclipse.jetty.servlet.ServletHolder; import org.hl7.fhir.dstu2016may.model.IdType; import org.hl7.fhir.dstu2016may.model.OperationOutcome; import org.hl7.fhir.dstu2016may.model.Patient; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.nio.charset.StandardCharsets; import java.util.concurrent.TimeUnit; @@ -146,7 +146,7 @@ public class UpdateDstu2_1Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/ValidateDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/ValidateDstu2_1Test.java index e1d9067fc51..9f928939725 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/ValidateDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/ValidateDstu2_1Test.java @@ -297,7 +297,7 @@ public class ValidateDstu2_1Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/ctx/FhirContextDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/ctx/FhirContextDstu2Test.java index aaf8545ddbd..b628f4dfda3 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/ctx/FhirContextDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/ctx/FhirContextDstu2Test.java @@ -132,7 +132,7 @@ public class FhirContextDstu2Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } //Source: https://github.com/junit-team/junit4/wiki/multithreaded-code-and-concurrency diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/dstu2/BundleTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/dstu2/BundleTest.java index 8be272b34ae..6d094ad5666 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/dstu2/BundleTest.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/dstu2/BundleTest.java @@ -15,7 +15,7 @@ public class BundleTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/dstu2/CompartmentDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/dstu2/CompartmentDstu2Test.java index 409edbb359f..f32d893e1a6 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/dstu2/CompartmentDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/dstu2/CompartmentDstu2Test.java @@ -18,7 +18,7 @@ public class CompartmentDstu2Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/dstu2/ModelDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/dstu2/ModelDstu2Test.java index bcd5e58e2d0..dc2954280a6 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/dstu2/ModelDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/dstu2/ModelDstu2Test.java @@ -100,7 +100,7 @@ public class ModelDstu2Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/dstu2/ModelInstantiationTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/dstu2/ModelInstantiationTest.java index 27eaa4d7402..bf7f855867b 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/dstu2/ModelInstantiationTest.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/dstu2/ModelInstantiationTest.java @@ -19,7 +19,7 @@ public class ModelInstantiationTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/dstu2/ModelSerializationDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/dstu2/ModelSerializationDstu2Test.java index f72ca9f4ed0..39f3cc63e6a 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/dstu2/ModelSerializationDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/dstu2/ModelSerializationDstu2Test.java @@ -29,7 +29,7 @@ public class ModelSerializationDstu2Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/primitive/BaseDateTimeDtDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/primitive/BaseDateTimeDtDstu2Test.java index 937b234f930..410b5cb30d7 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/primitive/BaseDateTimeDtDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/primitive/BaseDateTimeDtDstu2Test.java @@ -827,7 +827,7 @@ public class BaseDateTimeDtDstu2Test { @AfterAll public static void afterClassClearContext() { Locale.setDefault(ourDefaultLocale); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/primitive/BaseResourceReferenceDtTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/primitive/BaseResourceReferenceDtTest.java index ba1b4b9c64f..28993195400 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/primitive/BaseResourceReferenceDtTest.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/primitive/BaseResourceReferenceDtTest.java @@ -17,9 +17,9 @@ import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.message.BasicHeader; import org.apache.http.message.BasicStatusLine; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; import org.mockito.invocation.InvocationOnMock; @@ -45,7 +45,7 @@ public class BaseResourceReferenceDtTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/primitive/DateDtTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/primitive/DateDtTest.java index e92eee81eaa..99ed13cd962 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/primitive/DateDtTest.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/primitive/DateDtTest.java @@ -14,7 +14,7 @@ public class DateDtTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/narrative/DefaultThymeleafNarrativeGeneratorDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/narrative/DefaultThymeleafNarrativeGeneratorDstu2Test.java index f96f093cc9a..d06534bd888 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/narrative/DefaultThymeleafNarrativeGeneratorDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/narrative/DefaultThymeleafNarrativeGeneratorDstu2Test.java @@ -182,7 +182,7 @@ public class DefaultThymeleafNarrativeGeneratorDstu2Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/CustomTypeDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/CustomTypeDstu2Test.java index d9cca9a8dac..db59fc1d5e6 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/CustomTypeDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/CustomTypeDstu2Test.java @@ -41,7 +41,7 @@ public class CustomTypeDstu2Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } /** diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/ElementWithExtensionDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/ElementWithExtensionDstu2Test.java index 115010a96f2..92931cb0b58 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/ElementWithExtensionDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/ElementWithExtensionDstu2Test.java @@ -21,7 +21,7 @@ public class ElementWithExtensionDstu2Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @Test diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/EmptyElementWithExtensionDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/EmptyElementWithExtensionDstu2Test.java index ec39f396c61..7049a25bc4f 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/EmptyElementWithExtensionDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/EmptyElementWithExtensionDstu2Test.java @@ -20,7 +20,7 @@ public class EmptyElementWithExtensionDstu2Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/ExtensionsDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/ExtensionsDstu2Test.java index 7d9b25b9824..2b4f18f6b93 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/ExtensionsDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/ExtensionsDstu2Test.java @@ -19,7 +19,7 @@ public class ExtensionsDstu2Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserDstu2Test.java index 772c933462c..efc06ba529f 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserDstu2Test.java @@ -12,8 +12,23 @@ import ca.uhn.fhir.model.dstu2.composite.CodingDt; import ca.uhn.fhir.model.dstu2.composite.HumanNameDt; import ca.uhn.fhir.model.dstu2.composite.IdentifierDt; import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt; -import ca.uhn.fhir.model.dstu2.resource.*; +import ca.uhn.fhir.model.dstu2.resource.BaseResource; +import ca.uhn.fhir.model.dstu2.resource.Basic; +import ca.uhn.fhir.model.dstu2.resource.Binary; +import ca.uhn.fhir.model.dstu2.resource.Bundle; import ca.uhn.fhir.model.dstu2.resource.Bundle.Entry; +import ca.uhn.fhir.model.dstu2.resource.Condition; +import ca.uhn.fhir.model.dstu2.resource.Conformance; +import ca.uhn.fhir.model.dstu2.resource.DiagnosticReport; +import ca.uhn.fhir.model.dstu2.resource.DocumentManifest; +import ca.uhn.fhir.model.dstu2.resource.Goal; +import ca.uhn.fhir.model.dstu2.resource.Medication; +import ca.uhn.fhir.model.dstu2.resource.MedicationOrder; +import ca.uhn.fhir.model.dstu2.resource.Observation; +import ca.uhn.fhir.model.dstu2.resource.Organization; +import ca.uhn.fhir.model.dstu2.resource.Patient; +import ca.uhn.fhir.model.dstu2.resource.ProcedureRequest; +import ca.uhn.fhir.model.dstu2.resource.QuestionnaireResponse; import ca.uhn.fhir.model.dstu2.valueset.AdministrativeGenderEnum; import ca.uhn.fhir.model.dstu2.valueset.BundleTypeEnum; import ca.uhn.fhir.model.dstu2.valueset.ConditionVerificationStatusEnum; @@ -2199,7 +2214,7 @@ public class JsonParserDstu2Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } private static final class TimestampFields { diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserDstu2Test.java index 40ada003db2..db70c8eff81 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserDstu2Test.java @@ -9,12 +9,48 @@ import ca.uhn.fhir.model.api.TagList; import ca.uhn.fhir.model.api.annotation.Child; import ca.uhn.fhir.model.api.annotation.ResourceDef; import ca.uhn.fhir.model.base.composite.BaseCodingDt; -import ca.uhn.fhir.model.dstu2.composite.*; +import ca.uhn.fhir.model.dstu2.composite.AnnotationDt; +import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt; +import ca.uhn.fhir.model.dstu2.composite.CodingDt; +import ca.uhn.fhir.model.dstu2.composite.ContainedDt; +import ca.uhn.fhir.model.dstu2.composite.DurationDt; +import ca.uhn.fhir.model.dstu2.composite.ElementDefinitionDt; import ca.uhn.fhir.model.dstu2.composite.ElementDefinitionDt.Binding; -import ca.uhn.fhir.model.dstu2.resource.*; +import ca.uhn.fhir.model.dstu2.composite.HumanNameDt; +import ca.uhn.fhir.model.dstu2.composite.IdentifierDt; +import ca.uhn.fhir.model.dstu2.composite.QuantityDt; +import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt; +import ca.uhn.fhir.model.dstu2.composite.SimpleQuantityDt; +import ca.uhn.fhir.model.dstu2.resource.AllergyIntolerance; +import ca.uhn.fhir.model.dstu2.resource.Binary; +import ca.uhn.fhir.model.dstu2.resource.Bundle; import ca.uhn.fhir.model.dstu2.resource.Bundle.Entry; import ca.uhn.fhir.model.dstu2.resource.Bundle.Link; -import ca.uhn.fhir.model.dstu2.valueset.*; +import ca.uhn.fhir.model.dstu2.resource.Composition; +import ca.uhn.fhir.model.dstu2.resource.Condition; +import ca.uhn.fhir.model.dstu2.resource.DataElement; +import ca.uhn.fhir.model.dstu2.resource.DiagnosticReport; +import ca.uhn.fhir.model.dstu2.resource.Encounter; +import ca.uhn.fhir.model.dstu2.resource.Medication; +import ca.uhn.fhir.model.dstu2.resource.MedicationOrder; +import ca.uhn.fhir.model.dstu2.resource.MedicationStatement; +import ca.uhn.fhir.model.dstu2.resource.Observation; +import ca.uhn.fhir.model.dstu2.resource.Organization; +import ca.uhn.fhir.model.dstu2.resource.Parameters; +import ca.uhn.fhir.model.dstu2.resource.Patient; +import ca.uhn.fhir.model.dstu2.resource.Practitioner; +import ca.uhn.fhir.model.dstu2.valueset.AddressUseEnum; +import ca.uhn.fhir.model.dstu2.valueset.AdministrativeGenderEnum; +import ca.uhn.fhir.model.dstu2.valueset.BundleTypeEnum; +import ca.uhn.fhir.model.dstu2.valueset.ContactPointSystemEnum; +import ca.uhn.fhir.model.dstu2.valueset.DiagnosticReportStatusEnum; +import ca.uhn.fhir.model.dstu2.valueset.DocumentReferenceStatusEnum; +import ca.uhn.fhir.model.dstu2.valueset.IdentifierTypeCodesEnum; +import ca.uhn.fhir.model.dstu2.valueset.IdentifierUseEnum; +import ca.uhn.fhir.model.dstu2.valueset.MaritalStatusCodesEnum; +import ca.uhn.fhir.model.dstu2.valueset.NameUseEnum; +import ca.uhn.fhir.model.dstu2.valueset.ObservationRelationshipTypeEnum; +import ca.uhn.fhir.model.dstu2.valueset.ObservationStatusEnum; import ca.uhn.fhir.model.primitive.BooleanDt; import ca.uhn.fhir.model.primitive.DateDt; import ca.uhn.fhir.model.primitive.DateTimeDt; @@ -2924,7 +2960,7 @@ public class XmlParserDstu2Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } public static void main(String[] args) { diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/i391/TestOutcomeTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/i391/TestOutcomeTest.java index 705ce385b09..3ac19dc7b31 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/i391/TestOutcomeTest.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/i391/TestOutcomeTest.java @@ -80,7 +80,7 @@ public class TestOutcomeTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/jsonlike/JsonLikeParserDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/jsonlike/JsonLikeParserDstu2Test.java index 25075decef3..58381164c8e 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/jsonlike/JsonLikeParserDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/jsonlike/JsonLikeParserDstu2Test.java @@ -38,6 +38,6 @@ public class JsonLikeParserDstu2Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/BundleTypeDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/BundleTypeDstu2Test.java index 3467ae4044a..b4cb515b12e 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/BundleTypeDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/BundleTypeDstu2Test.java @@ -21,9 +21,9 @@ import org.apache.http.message.BasicHeader; import org.apache.http.message.BasicStatusLine; import org.hamcrest.Matchers; import org.hl7.fhir.instance.model.api.IBaseResource; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; @@ -46,7 +46,7 @@ public class BundleTypeDstu2Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/ClientMockingTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/ClientMockingTest.java index b78fa0afaec..222e4dd2ea0 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/ClientMockingTest.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/ClientMockingTest.java @@ -20,7 +20,7 @@ public class ClientMockingTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationDstu2Test.java index cdf8cbf6038..64fe0540563 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationDstu2Test.java @@ -20,9 +20,9 @@ import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.message.BasicHeader; import org.apache.http.message.BasicStatusLine; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.Matchers; import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; @@ -56,7 +56,7 @@ public class ClientServerValidationDstu2Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/ClientWithProfileDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/ClientWithProfileDstu2Test.java index a3aa5cfd783..3a800a382cf 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/ClientWithProfileDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/ClientWithProfileDstu2Test.java @@ -18,9 +18,9 @@ import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.message.BasicHeader; import org.apache.http.message.BasicStatusLine; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; import org.mockito.invocation.InvocationOnMock; @@ -44,7 +44,7 @@ public class ClientWithProfileDstu2Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/ETagClientDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/ETagClientDstu2Test.java index ee74bfa7c32..93bcb1219c7 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/ETagClientDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/ETagClientDstu2Test.java @@ -20,10 +20,10 @@ import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.message.BasicHeader; import org.apache.http.message.BasicStatusLine; import org.hamcrest.core.StringContains; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; @@ -49,7 +49,7 @@ public class ETagClientDstu2Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeEach diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu2Test.java index a6b755da160..2d1be93ede3 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu2Test.java @@ -20,8 +20,6 @@ import ca.uhn.fhir.model.dstu2.resource.Observation; import ca.uhn.fhir.model.dstu2.resource.OperationOutcome; import ca.uhn.fhir.model.dstu2.resource.Parameters; import ca.uhn.fhir.model.dstu2.resource.Patient; -import ca.uhn.fhir.model.dstu2.valueset.BundleTypeEnum; -import ca.uhn.fhir.model.dstu2.valueset.HTTPVerbEnum; import ca.uhn.fhir.model.primitive.CodeDt; import ca.uhn.fhir.model.primitive.DateDt; import ca.uhn.fhir.model.primitive.IdDt; @@ -44,7 +42,6 @@ import ca.uhn.fhir.rest.client.api.IHttpClient; import ca.uhn.fhir.rest.client.api.IRestfulClient; import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum; import ca.uhn.fhir.rest.client.exceptions.InvalidResponseException; -import ca.uhn.fhir.rest.client.exceptions.NonFhirResponseException; import ca.uhn.fhir.rest.client.impl.BaseClient; import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor; import ca.uhn.fhir.rest.param.DateParam; @@ -2734,7 +2731,7 @@ public class GenericClientDstu2Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/MessageClientDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/MessageClientDstu2Test.java index 4af974c8da4..bdd5ffa8d44 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/MessageClientDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/MessageClientDstu2Test.java @@ -49,7 +49,7 @@ public class MessageClientDstu2Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeEach diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/OperationClientDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/OperationClientDstu2Test.java index fa7cac1a1a5..4e5e3df2a7f 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/OperationClientDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/OperationClientDstu2Test.java @@ -51,7 +51,7 @@ public class OperationClientDstu2Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/RestfulClientFactoryDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/RestfulClientFactoryDstu2Test.java index dcedf922bc9..afa5206c61f 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/RestfulClientFactoryDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/RestfulClientFactoryDstu2Test.java @@ -74,6 +74,6 @@ public class RestfulClientFactoryDstu2Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/apache/ApacheClientIntegrationTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/apache/ApacheClientIntegrationTest.java index b4ad22b97b9..b4a6be35be7 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/apache/ApacheClientIntegrationTest.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/apache/ApacheClientIntegrationTest.java @@ -16,10 +16,10 @@ import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.hl7.fhir.instance.model.api.IBaseResource; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.List; @@ -57,7 +57,7 @@ public class ApacheClientIntegrationTest { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/param/TokenOrListParamDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/param/TokenOrListParamDstu2Test.java index d12e6f1f008..10045f83739 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/param/TokenOrListParamDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/param/TokenOrListParamDstu2Test.java @@ -53,7 +53,7 @@ public class TokenOrListParamDstu2Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/BinaryDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/BinaryDstu2Test.java index 4d0b77c6288..14e43f79bf3 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/BinaryDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/BinaryDstu2Test.java @@ -248,7 +248,7 @@ public class BinaryDstu2Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/BundleTypeInResponseTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/BundleTypeInResponseTest.java index e978f992d7a..d0608fb2839 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/BundleTypeInResponseTest.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/BundleTypeInResponseTest.java @@ -19,9 +19,9 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletHolder; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.List; @@ -61,7 +61,7 @@ public class BundleTypeInResponseTest { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/CompartmentDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/CompartmentDstu2Test.java index 359c9a563c3..96d6cc85f09 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/CompartmentDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/CompartmentDstu2Test.java @@ -50,7 +50,7 @@ public class CompartmentDstu2Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/CreateConditionalTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/CreateConditionalTest.java index db0f3c299c9..60e487dbf19 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/CreateConditionalTest.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/CreateConditionalTest.java @@ -27,10 +27,10 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletHolder; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.List; @@ -145,7 +145,7 @@ public class CreateConditionalTest { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/DeleteDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/DeleteDstu2Test.java index 946109b7600..13c9a918b6f 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/DeleteDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/DeleteDstu2Test.java @@ -19,10 +19,10 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletHolder; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.util.concurrent.TimeUnit; @@ -83,7 +83,7 @@ public class DeleteDstu2Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ETagServerTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ETagServerTest.java index e13099430d8..73dccb78629 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ETagServerTest.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ETagServerTest.java @@ -31,10 +31,10 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletHolder; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.IOException; import java.util.Date; @@ -192,7 +192,7 @@ public class ETagServerTest { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/IncludeAndRevincludeParameterTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/IncludeAndRevincludeParameterTest.java index 584b2f94bf8..9627fcc509f 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/IncludeAndRevincludeParameterTest.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/IncludeAndRevincludeParameterTest.java @@ -18,10 +18,10 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletHolder; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.List; @@ -83,7 +83,7 @@ public class IncludeAndRevincludeParameterTest { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/IncludeDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/IncludeDstu2Test.java index 6a975c8fcc2..03f226af1f9 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/IncludeDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/IncludeDstu2Test.java @@ -452,7 +452,7 @@ public class IncludeDstu2Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/OperationDuplicateServerDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/OperationDuplicateServerDstu2Test.java index db916678122..caeac0d1e9b 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/OperationDuplicateServerDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/OperationDuplicateServerDstu2Test.java @@ -79,7 +79,7 @@ public class OperationDuplicateServerDstu2Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/OperationServerDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/OperationServerDstu2Test.java index 4dfa2813cc4..5c389f0eff4 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/OperationServerDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/OperationServerDstu2Test.java @@ -544,7 +544,7 @@ public class OperationServerDstu2Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/OperationServerWithSearchParamTypesDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/OperationServerWithSearchParamTypesDstu2Test.java index 5b7ff389697..441964a2290 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/OperationServerWithSearchParamTypesDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/OperationServerWithSearchParamTypesDstu2Test.java @@ -329,7 +329,7 @@ public class OperationServerWithSearchParamTypesDstu2Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ReadDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ReadDstu2Test.java index d2c4b32f5da..300dacfa4d3 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ReadDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ReadDstu2Test.java @@ -235,7 +235,7 @@ public class ReadDstu2Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchBundleProviderWithNoSizeDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchBundleProviderWithNoSizeDstu2Test.java index a9476125c83..8e330e82ddc 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchBundleProviderWithNoSizeDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchBundleProviderWithNoSizeDstu2Test.java @@ -1,18 +1,12 @@ package ca.uhn.fhir.rest.server; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.model.dstu2.resource.Bundle; -import ca.uhn.fhir.model.dstu2.resource.Bundle.Link; import ca.uhn.fhir.model.dstu2.resource.Patient; import ca.uhn.fhir.rest.annotation.Search; import ca.uhn.fhir.rest.api.server.IBundleProvider; import ca.uhn.fhir.rest.param.TokenAndListParam; import ca.uhn.fhir.test.utilities.JettyUtil; import ca.uhn.fhir.util.TestUtil; -import com.google.common.collect.Lists; -import org.apache.commons.io.IOUtils; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; @@ -20,25 +14,12 @@ import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.hl7.fhir.instance.model.api.IBaseResource; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.List; import java.util.concurrent.TimeUnit; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - public class SearchBundleProviderWithNoSizeDstu2Test { private static CloseableHttpClient ourClient; @@ -61,7 +42,7 @@ public class SearchBundleProviderWithNoSizeDstu2Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchCountParamDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchCountParamDstu2Test.java index 2f2d22a75f5..e8a575a9833 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchCountParamDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchCountParamDstu2Test.java @@ -111,7 +111,7 @@ public class SearchCountParamDstu2Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchDstu2Test.java index df031ce4242..3e57866e46d 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchDstu2Test.java @@ -505,7 +505,7 @@ public class SearchDstu2Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchReturningProfiledResourceDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchReturningProfiledResourceDstu2Test.java index 9c5609bc26b..c04e524443f 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchReturningProfiledResourceDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchReturningProfiledResourceDstu2Test.java @@ -1,26 +1,5 @@ package ca.uhn.fhir.rest.server; -import static org.hamcrest.Matchers.containsString; -import static org.hamcrest.Matchers.not; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.hamcrest.MatcherAssert.assertThat; - -import java.util.*; -import java.util.concurrent.TimeUnit; - -import ca.uhn.fhir.rest.api.EncodingEnum; -import org.apache.commons.io.IOUtils; -import org.apache.http.HttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.servlet.ServletHandler; -import org.eclipse.jetty.servlet.ServletHolder; -import org.hl7.fhir.instance.model.api.IBaseResource; -import org.junit.jupiter.api.*; import static org.hamcrest.MatcherAssert.assertThat; - import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum; import ca.uhn.fhir.model.api.annotation.Description; @@ -30,6 +9,7 @@ import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.rest.annotation.OptionalParam; import ca.uhn.fhir.rest.annotation.Search; import ca.uhn.fhir.rest.api.Constants; +import ca.uhn.fhir.rest.api.EncodingEnum; import ca.uhn.fhir.rest.client.api.IGenericClient; import ca.uhn.fhir.rest.param.DateRangeParam; import ca.uhn.fhir.rest.param.StringParam; @@ -37,8 +17,29 @@ import ca.uhn.fhir.rest.server.interceptor.ResponseHighlighterInterceptor; import ca.uhn.fhir.test.utilities.JettyUtil; import ca.uhn.fhir.util.TestUtil; import ca.uhn.fhir.validation.PatientProfileDstu2; +import org.apache.commons.io.IOUtils; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.servlet.ServletHandler; +import org.eclipse.jetty.servlet.ServletHolder; +import org.hl7.fhir.instance.model.api.IBaseResource; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.concurrent.TimeUnit; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.not; +import static org.junit.jupiter.api.Assertions.assertEquals; public class SearchReturningProfiledResourceDstu2Test { @@ -107,7 +108,7 @@ public class SearchReturningProfiledResourceDstu2Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchWithDstu2BundleTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchWithDstu2BundleTest.java index 8f0235c84b9..f609c3583a1 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchWithDstu2BundleTest.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchWithDstu2BundleTest.java @@ -66,7 +66,7 @@ public class SearchWithDstu2BundleTest { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchWithGenericListDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchWithGenericListDstu2Test.java index 5c0f0e67a30..1cd0e34a250 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchWithGenericListDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchWithGenericListDstu2Test.java @@ -67,7 +67,7 @@ public class SearchWithGenericListDstu2Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ServerConformanceProviderDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ServerConformanceProviderDstu2Test.java index c627b4d54b9..fa876507dec 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ServerConformanceProviderDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ServerConformanceProviderDstu2Test.java @@ -921,7 +921,7 @@ public class ServerConformanceProviderDstu2Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ServerFeaturesDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ServerFeaturesDstu2Test.java index a69907b07a7..03e45b6bafe 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ServerFeaturesDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ServerFeaturesDstu2Test.java @@ -165,7 +165,7 @@ public class ServerFeaturesDstu2Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ServerSearchDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ServerSearchDstu2Test.java index 60705246a3b..4aa3af0638f 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ServerSearchDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ServerSearchDstu2Test.java @@ -127,7 +127,7 @@ public class ServerSearchDstu2Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SummaryParamDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SummaryParamDstu2Test.java index 67434fe706b..bf6cfdb4da7 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SummaryParamDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SummaryParamDstu2Test.java @@ -325,7 +325,7 @@ public class SummaryParamDstu2Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/TransactionWithBundleResourceParamTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/TransactionWithBundleResourceParamTest.java index 073ad4bd1b2..f0930d2f5ef 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/TransactionWithBundleResourceParamTest.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/TransactionWithBundleResourceParamTest.java @@ -221,7 +221,7 @@ public class TransactionWithBundleResourceParamTest { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/TransactionWithVersionlessBundleResourceParamTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/TransactionWithVersionlessBundleResourceParamTest.java index 362c6a69a9c..ce1263d5831 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/TransactionWithVersionlessBundleResourceParamTest.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/TransactionWithVersionlessBundleResourceParamTest.java @@ -85,7 +85,7 @@ public class TransactionWithVersionlessBundleResourceParamTest { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/UpdateDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/UpdateDstu2Test.java index a6d69e5a8f9..3db6f7cd78e 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/UpdateDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/UpdateDstu2Test.java @@ -145,7 +145,7 @@ public class UpdateDstu2Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ValidateDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ValidateDstu2Test.java index c8e1ffd47d5..d3738f289e0 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ValidateDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ValidateDstu2Test.java @@ -157,7 +157,7 @@ public class ValidateDstu2Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/interceptor/InterceptorUserDataMapDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/interceptor/InterceptorUserDataMapDstu2Test.java index d543ecfa2d1..fed8bf429f8 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/interceptor/InterceptorUserDataMapDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/interceptor/InterceptorUserDataMapDstu2Test.java @@ -272,7 +272,7 @@ public class InterceptorUserDataMapDstu2Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/interceptor/LoggingInterceptorDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/interceptor/LoggingInterceptorDstu2Test.java index 5beaa0109b8..41fdd43c6bd 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/interceptor/LoggingInterceptorDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/interceptor/LoggingInterceptorDstu2Test.java @@ -390,7 +390,7 @@ public class LoggingInterceptorDstu2Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/interceptor/ServerActionInterceptorTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/interceptor/ServerActionInterceptorTest.java index 65fc1b5f248..cb6e14e8ebe 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/interceptor/ServerActionInterceptorTest.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/interceptor/ServerActionInterceptorTest.java @@ -65,7 +65,7 @@ public class ServerActionInterceptorTest { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/provider/dstu2/Dstu2BundleFactoryTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/provider/dstu2/Dstu2BundleFactoryTest.java index c887b9e6cbe..f67825046a8 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/provider/dstu2/Dstu2BundleFactoryTest.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/provider/dstu2/Dstu2BundleFactoryTest.java @@ -40,7 +40,7 @@ public class Dstu2BundleFactoryTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeEach diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/util/FhirTerserDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/util/FhirTerserDstu2Test.java index 5dbee6f6085..83c06088bd5 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/util/FhirTerserDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/util/FhirTerserDstu2Test.java @@ -831,7 +831,7 @@ public class FhirTerserDstu2Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } /** diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/validation/BundleValidationTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/validation/BundleValidationTest.java index 0931d6c8dcb..e6450da4c1b 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/validation/BundleValidationTest.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/validation/BundleValidationTest.java @@ -65,6 +65,6 @@ public class BundleValidationTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/validation/ResourceValidatorDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/validation/ResourceValidatorDstu2Test.java index d31db258986..3dc20c22e4b 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/validation/ResourceValidatorDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/validation/ResourceValidatorDstu2Test.java @@ -380,6 +380,6 @@ public class ResourceValidatorDstu2Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/validation/ValidatorInstantiatorDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/validation/ValidatorInstantiatorDstu2Test.java index a4ea342eaa4..7094255f83f 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/validation/ValidatorInstantiatorDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/validation/ValidatorInstantiatorDstu2Test.java @@ -13,7 +13,7 @@ public class ValidatorInstantiatorDstu2Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/context/ContextScanningDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/context/ContextScanningDstu3Test.java index a6aa9fd0549..5dd67c5faec 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/context/ContextScanningDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/context/ContextScanningDstu3Test.java @@ -1,21 +1,5 @@ package ca.uhn.fhir.context; -import static org.hamcrest.Matchers.containsInRelativeOrder; -import static org.hamcrest.Matchers.not; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import java.util.TreeSet; - -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.servlet.ServletHandler; -import org.eclipse.jetty.servlet.ServletHolder; -import org.hl7.fhir.dstu3.model.*; -import org.hl7.fhir.dstu3.model.Observation.ObservationStatus; -import org.hl7.fhir.exceptions.FHIRFormatError; -import org.junit.jupiter.api.*; import static org.hamcrest.MatcherAssert.assertThat; - import ca.uhn.fhir.rest.annotation.IdParam; import ca.uhn.fhir.rest.annotation.Read; import ca.uhn.fhir.rest.client.api.IGenericClient; @@ -23,8 +7,26 @@ import ca.uhn.fhir.rest.server.IResourceProvider; import ca.uhn.fhir.rest.server.RestfulServer; import ca.uhn.fhir.test.utilities.JettyUtil; import ca.uhn.fhir.util.TestUtil; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.servlet.ServletHandler; +import org.eclipse.jetty.servlet.ServletHolder; +import org.hl7.fhir.dstu3.model.IdType; +import org.hl7.fhir.dstu3.model.Observation; +import org.hl7.fhir.dstu3.model.Observation.ObservationStatus; +import org.hl7.fhir.dstu3.model.Patient; +import org.hl7.fhir.dstu3.model.StringType; +import org.hl7.fhir.exceptions.FHIRFormatError; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import java.util.TreeSet; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.containsInRelativeOrder; +import static org.hamcrest.Matchers.not; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; public class ContextScanningDstu3Test { private static FhirContext ourCtx = FhirContext.forDstu3(); @@ -140,7 +142,7 @@ public class ContextScanningDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/context/FhirContextDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/context/FhirContextDstu3Test.java index ef4d4b0468b..4d6c134a777 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/context/FhirContextDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/context/FhirContextDstu3Test.java @@ -192,7 +192,7 @@ public class FhirContextDstu3Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/context/ModelScannerDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/context/ModelScannerDstu3Test.java index b938320d5a7..5404835956e 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/context/ModelScannerDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/context/ModelScannerDstu3Test.java @@ -437,7 +437,7 @@ public class ModelScannerDstu3Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/context/RuntimeResourceDefinitionDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/context/RuntimeResourceDefinitionDstu3Test.java index 1d215b9b46e..9f18161012c 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/context/RuntimeResourceDefinitionDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/context/RuntimeResourceDefinitionDstu3Test.java @@ -30,7 +30,7 @@ public class RuntimeResourceDefinitionDstu3Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/model/DateTypeTest.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/model/DateTypeTest.java index f892d98c9ab..25c7416bebe 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/model/DateTypeTest.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/model/DateTypeTest.java @@ -17,7 +17,7 @@ public class DateTypeTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @Test diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/model/IdTypeDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/model/IdTypeDstu3Test.java index 9cda7bd825f..afc47d25e3e 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/model/IdTypeDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/model/IdTypeDstu3Test.java @@ -325,7 +325,7 @@ public class IdTypeDstu3Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/model/ModelDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/model/ModelDstu3Test.java index f4feab8d812..d8c12cddab7 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/model/ModelDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/model/ModelDstu3Test.java @@ -79,7 +79,7 @@ public class ModelDstu3Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/model/ModelSerializationDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/model/ModelSerializationDstu3Test.java index e7b54839acc..3f09005d112 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/model/ModelSerializationDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/model/ModelSerializationDstu3Test.java @@ -36,7 +36,7 @@ public class ModelSerializationDstu3Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/model/XhtmlNodeTest.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/model/XhtmlNodeTest.java index fb910da5950..2ffd3baf739 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/model/XhtmlNodeTest.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/model/XhtmlNodeTest.java @@ -15,7 +15,7 @@ public class XhtmlNodeTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } private static FhirContext ourCtx = FhirContext.forDstu3(); diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/narrative/DefaultThymeleafNarrativeGeneratorDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/narrative/DefaultThymeleafNarrativeGeneratorDstu3Test.java index c5827989db2..b60fb81274b 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/narrative/DefaultThymeleafNarrativeGeneratorDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/narrative/DefaultThymeleafNarrativeGeneratorDstu3Test.java @@ -302,7 +302,7 @@ public class DefaultThymeleafNarrativeGeneratorDstu3Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/CustomTypeDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/CustomTypeDstu3Test.java index dee588f0120..adb1da2cce0 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/CustomTypeDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/CustomTypeDstu3Test.java @@ -20,9 +20,9 @@ import org.hl7.fhir.dstu3.model.Period; import org.hl7.fhir.dstu3.model.Quantity; import org.hl7.fhir.dstu3.model.StringType; import org.hl7.fhir.dstu3.model.Type; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.List; @@ -46,7 +46,7 @@ public class CustomTypeDstu3Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @ResourceDef diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/ElementWithExtensionDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/ElementWithExtensionDstu3Test.java index 850fd17672d..0f94c02b08e 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/ElementWithExtensionDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/ElementWithExtensionDstu3Test.java @@ -24,7 +24,7 @@ public class ElementWithExtensionDstu3Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @Test diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/EmptyElementWithExtensionDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/EmptyElementWithExtensionDstu3Test.java index c961283d548..7693f78263a 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/EmptyElementWithExtensionDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/EmptyElementWithExtensionDstu3Test.java @@ -22,7 +22,7 @@ public class EmptyElementWithExtensionDstu3Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/JsonParserDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/JsonParserDstu3Test.java index 528ae5133f3..3096ae57e5f 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/JsonParserDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/JsonParserDstu3Test.java @@ -18,16 +18,58 @@ import net.sf.json.JsonConfig; import org.apache.commons.io.IOUtils; import org.hamcrest.Matchers; import org.hamcrest.core.StringContains; -import org.hl7.fhir.dstu3.model.*; +import org.hl7.fhir.dstu3.model.Address; import org.hl7.fhir.dstu3.model.Address.AddressUse; import org.hl7.fhir.dstu3.model.Address.AddressUseEnumFactory; +import org.hl7.fhir.dstu3.model.Attachment; +import org.hl7.fhir.dstu3.model.AuditEvent; +import org.hl7.fhir.dstu3.model.Basic; +import org.hl7.fhir.dstu3.model.Binary; +import org.hl7.fhir.dstu3.model.Bundle; import org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent; import org.hl7.fhir.dstu3.model.Bundle.BundleType; +import org.hl7.fhir.dstu3.model.CapabilityStatement; import org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode; +import org.hl7.fhir.dstu3.model.Claim; +import org.hl7.fhir.dstu3.model.Coding; +import org.hl7.fhir.dstu3.model.Communication; +import org.hl7.fhir.dstu3.model.Composition; +import org.hl7.fhir.dstu3.model.Condition; import org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus; +import org.hl7.fhir.dstu3.model.Coverage; +import org.hl7.fhir.dstu3.model.DateTimeType; +import org.hl7.fhir.dstu3.model.DateType; +import org.hl7.fhir.dstu3.model.DecimalType; +import org.hl7.fhir.dstu3.model.DiagnosticReport; +import org.hl7.fhir.dstu3.model.DocumentManifest; +import org.hl7.fhir.dstu3.model.Dosage; +import org.hl7.fhir.dstu3.model.EnumFactory; +import org.hl7.fhir.dstu3.model.Enumeration; import org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender; +import org.hl7.fhir.dstu3.model.ExplanationOfBenefit; +import org.hl7.fhir.dstu3.model.Extension; +import org.hl7.fhir.dstu3.model.HumanName; +import org.hl7.fhir.dstu3.model.IdType; import org.hl7.fhir.dstu3.model.Identifier.IdentifierUse; +import org.hl7.fhir.dstu3.model.Linkage; +import org.hl7.fhir.dstu3.model.Medication; +import org.hl7.fhir.dstu3.model.MedicationRequest; +import org.hl7.fhir.dstu3.model.Observation; import org.hl7.fhir.dstu3.model.Observation.ObservationStatus; +import org.hl7.fhir.dstu3.model.Organization; +import org.hl7.fhir.dstu3.model.Parameters; +import org.hl7.fhir.dstu3.model.Patient; +import org.hl7.fhir.dstu3.model.PrimitiveType; +import org.hl7.fhir.dstu3.model.Quantity; +import org.hl7.fhir.dstu3.model.QuestionnaireResponse; +import org.hl7.fhir.dstu3.model.Reference; +import org.hl7.fhir.dstu3.model.RelatedPerson; +import org.hl7.fhir.dstu3.model.Resource; +import org.hl7.fhir.dstu3.model.SampledData; +import org.hl7.fhir.dstu3.model.SimpleQuantity; +import org.hl7.fhir.dstu3.model.StringType; +import org.hl7.fhir.dstu3.model.UriType; +import org.hl7.fhir.dstu3.model.ValueSet; import org.hl7.fhir.instance.model.api.IIdType; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; @@ -2496,6 +2538,6 @@ public class JsonParserDstu3Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/XmlParserDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/XmlParserDstu3Test.java index ee7220916eb..ae7f018f50f 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/XmlParserDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/XmlParserDstu3Test.java @@ -18,19 +18,68 @@ import org.hamcrest.core.StringContains; import org.hamcrest.text.StringContainsInOrder; import org.hl7.fhir.dstu3.model.Address.AddressUse; import org.hl7.fhir.dstu3.model.Address.AddressUseEnumFactory; -import org.hl7.fhir.dstu3.model.*; +import org.hl7.fhir.dstu3.model.AllergyIntolerance; +import org.hl7.fhir.dstu3.model.Annotation; +import org.hl7.fhir.dstu3.model.Appointment; +import org.hl7.fhir.dstu3.model.AuditEvent; +import org.hl7.fhir.dstu3.model.Binary; +import org.hl7.fhir.dstu3.model.BooleanType; +import org.hl7.fhir.dstu3.model.Bundle; import org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent; import org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent; import org.hl7.fhir.dstu3.model.Bundle.BundleType; +import org.hl7.fhir.dstu3.model.CapabilityStatement; +import org.hl7.fhir.dstu3.model.CodeType; +import org.hl7.fhir.dstu3.model.CodeableConcept; +import org.hl7.fhir.dstu3.model.Coding; +import org.hl7.fhir.dstu3.model.Composition; +import org.hl7.fhir.dstu3.model.ConceptMap; +import org.hl7.fhir.dstu3.model.Condition; import org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem; +import org.hl7.fhir.dstu3.model.DataElement; +import org.hl7.fhir.dstu3.model.DateTimeType; +import org.hl7.fhir.dstu3.model.DateType; +import org.hl7.fhir.dstu3.model.DecimalType; +import org.hl7.fhir.dstu3.model.DiagnosticReport; import org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus; +import org.hl7.fhir.dstu3.model.DocumentManifest; +import org.hl7.fhir.dstu3.model.Dosage; +import org.hl7.fhir.dstu3.model.Duration; +import org.hl7.fhir.dstu3.model.ElementDefinition; import org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent; +import org.hl7.fhir.dstu3.model.Encounter; +import org.hl7.fhir.dstu3.model.EnumFactory; +import org.hl7.fhir.dstu3.model.Enumeration; import org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender; import org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus; +import org.hl7.fhir.dstu3.model.Extension; +import org.hl7.fhir.dstu3.model.GuidanceResponse; +import org.hl7.fhir.dstu3.model.HumanName; import org.hl7.fhir.dstu3.model.HumanName.NameUse; +import org.hl7.fhir.dstu3.model.IdType; +import org.hl7.fhir.dstu3.model.Identifier; import org.hl7.fhir.dstu3.model.Identifier.IdentifierUse; +import org.hl7.fhir.dstu3.model.InstantType; +import org.hl7.fhir.dstu3.model.Location; +import org.hl7.fhir.dstu3.model.Medication; +import org.hl7.fhir.dstu3.model.MedicationRequest; +import org.hl7.fhir.dstu3.model.MedicationStatement; +import org.hl7.fhir.dstu3.model.Observation; import org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType; import org.hl7.fhir.dstu3.model.Observation.ObservationStatus; +import org.hl7.fhir.dstu3.model.Organization; +import org.hl7.fhir.dstu3.model.Patient; +import org.hl7.fhir.dstu3.model.Practitioner; +import org.hl7.fhir.dstu3.model.PrimitiveType; +import org.hl7.fhir.dstu3.model.ProcedureRequest; +import org.hl7.fhir.dstu3.model.Quantity; +import org.hl7.fhir.dstu3.model.Reference; +import org.hl7.fhir.dstu3.model.Resource; +import org.hl7.fhir.dstu3.model.SampledData; +import org.hl7.fhir.dstu3.model.SimpleQuantity; +import org.hl7.fhir.dstu3.model.StringType; +import org.hl7.fhir.dstu3.model.UriType; +import org.hl7.fhir.dstu3.model.ValueSet; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IIdType; import org.junit.jupiter.api.AfterAll; @@ -3569,7 +3618,7 @@ public class XmlParserDstu3Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } public static void compareXml(String content, String reEncoded) { diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/jsonlike/JsonLikeParserDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/jsonlike/JsonLikeParserDstu3Test.java index 2d41cefb484..957072fb01a 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/jsonlike/JsonLikeParserDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/jsonlike/JsonLikeParserDstu3Test.java @@ -90,7 +90,7 @@ public class JsonLikeParserDstu3Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/ClientMimetypeDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/ClientMimetypeDstu3Test.java index 656b6bb4446..f0fd6b582ef 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/ClientMimetypeDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/ClientMimetypeDstu3Test.java @@ -1,32 +1,5 @@ package ca.uhn.fhir.rest.client; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.io.IOException; -import java.io.StringReader; -import java.nio.charset.Charset; - -import org.apache.commons.io.IOUtils; -import org.apache.commons.io.input.ReaderInputStream; -import org.apache.http.*; -import org.apache.http.client.ClientProtocolException; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; -import org.apache.http.client.methods.HttpUriRequest; -import org.apache.http.message.BasicHeader; -import org.apache.http.message.BasicStatusLine; -import org.hl7.fhir.dstu3.model.Patient; -import org.junit.jupiter.api.*; import static org.hamcrest.MatcherAssert.assertThat; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; -import org.mockito.ArgumentCaptor; -import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; - import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.parser.IParser; import ca.uhn.fhir.rest.api.Constants; @@ -34,6 +7,34 @@ import ca.uhn.fhir.rest.api.MethodOutcome; import ca.uhn.fhir.rest.client.api.IGenericClient; import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum; import ca.uhn.fhir.util.TestUtil; +import org.apache.commons.io.IOUtils; +import org.apache.commons.io.input.ReaderInputStream; +import org.apache.http.Header; +import org.apache.http.HttpResponse; +import org.apache.http.ProtocolVersion; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.message.BasicHeader; +import org.apache.http.message.BasicStatusLine; +import org.hl7.fhir.dstu3.model.Patient; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; + +import java.io.IOException; +import java.io.StringReader; +import java.nio.charset.Charset; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; /** * http://gforge.hl7.org/gf/project/fhir/tracker/?action=TrackerItemEdit&tracker_id=677&tracker_item_id=10199 @@ -163,7 +164,7 @@ public class ClientMimetypeDstu3Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationDstu3Test.java index b43e1c3fe76..99fb3f6a337 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationDstu3Test.java @@ -144,6 +144,6 @@ public class ClientServerValidationDstu3Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/ClientWithCustomTypeDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/ClientWithCustomTypeDstu3Test.java index 85a8eac424e..1d3d9372b0d 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/ClientWithCustomTypeDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/ClientWithCustomTypeDstu3Test.java @@ -19,10 +19,10 @@ import org.hl7.fhir.dstu3.model.Bundle; import org.hl7.fhir.dstu3.model.Organization; import org.hl7.fhir.instance.model.api.IAnyResource; import org.hl7.fhir.instance.model.api.IBaseResource; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; import org.mockito.invocation.InvocationOnMock; @@ -43,7 +43,7 @@ public class ClientWithCustomTypeDstu3Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeEach diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu3Test.java index 130aec7454f..fc084f2f101 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu3Test.java @@ -1999,7 +1999,7 @@ public class GenericClientDstu3Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/NonGenericClientDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/NonGenericClientDstu3Test.java index 3ee84c1ce17..beed3cb442f 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/NonGenericClientDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/NonGenericClientDstu3Test.java @@ -28,10 +28,10 @@ import org.hl7.fhir.dstu3.model.IdType; import org.hl7.fhir.dstu3.model.OperationOutcome; import org.hl7.fhir.dstu3.model.Patient; import org.hl7.fhir.instance.model.api.IBaseResource; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; import org.mockito.invocation.InvocationOnMock; @@ -167,7 +167,7 @@ public class NonGenericClientDstu3Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/OperationClientDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/OperationClientDstu3Test.java index 05c4769ba0b..421c1f3632f 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/OperationClientDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/OperationClientDstu3Test.java @@ -26,9 +26,9 @@ import org.apache.http.message.BasicHeader; import org.apache.http.message.BasicStatusLine; import org.hl7.fhir.dstu3.model.Parameters; import org.hl7.fhir.dstu3.model.StringType; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; import org.mockito.invocation.InvocationOnMock; @@ -57,7 +57,7 @@ public class OperationClientDstu3Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/PatchClientDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/PatchClientDstu3Test.java index c50cd3ac6c4..1563369ab61 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/PatchClientDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/PatchClientDstu3Test.java @@ -25,11 +25,11 @@ import org.apache.http.message.BasicStatusLine; import org.hl7.fhir.dstu3.model.IdType; import org.hl7.fhir.dstu3.model.OperationOutcome; import org.hl7.fhir.dstu3.model.Patient; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; import org.mockito.invocation.InvocationOnMock; @@ -129,7 +129,7 @@ public class PatchClientDstu3Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/SearchClientDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/SearchClientDstu3Test.java index 3dc16082881..1aac656ef81 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/SearchClientDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/SearchClientDstu3Test.java @@ -1,36 +1,11 @@ package ca.uhn.fhir.rest.client; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.io.InputStream; -import java.io.StringReader; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.util.*; - -import org.apache.commons.io.input.ReaderInputStream; -import org.apache.http.HttpResponse; -import org.apache.http.ProtocolVersion; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpUriRequest; -import org.apache.http.message.BasicHeader; -import org.apache.http.message.BasicStatusLine; -import org.hl7.fhir.dstu3.model.*; -import org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent; -import org.junit.jupiter.api.*; import static org.hamcrest.MatcherAssert.assertThat; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeEach; -import org.mockito.ArgumentCaptor; -import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; - import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.rest.annotation.*; import ca.uhn.fhir.rest.annotation.Count; +import ca.uhn.fhir.rest.annotation.OptionalParam; +import ca.uhn.fhir.rest.annotation.RequiredParam; +import ca.uhn.fhir.rest.annotation.Search; +import ca.uhn.fhir.rest.annotation.Sort; import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.SortOrderEnum; import ca.uhn.fhir.rest.api.SortSpec; @@ -39,6 +14,39 @@ import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum; import ca.uhn.fhir.rest.param.StringParam; import ca.uhn.fhir.util.TestUtil; import ca.uhn.fhir.util.UrlUtil; +import org.apache.commons.io.input.ReaderInputStream; +import org.apache.http.HttpResponse; +import org.apache.http.ProtocolVersion; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.message.BasicHeader; +import org.apache.http.message.BasicStatusLine; +import org.hl7.fhir.dstu3.model.Bundle; +import org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent; +import org.hl7.fhir.dstu3.model.Extension; +import org.hl7.fhir.dstu3.model.Location; +import org.hl7.fhir.dstu3.model.StringType; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; + +import java.io.InputStream; +import java.io.StringReader; +import java.nio.charset.StandardCharsets; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.List; +import java.util.TimeZone; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; public class SearchClientDstu3Test { @@ -49,7 +57,7 @@ public class SearchClientDstu3Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeEach diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/param/NumberParamTest.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/param/NumberParamTest.java index 43e4054a961..5de45b91f4e 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/param/NumberParamTest.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/param/NumberParamTest.java @@ -65,7 +65,7 @@ public class NumberParamTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/param/QuantityParamTest.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/param/QuantityParamTest.java index 140082cba22..977bb6b2426 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/param/QuantityParamTest.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/param/QuantityParamTest.java @@ -140,7 +140,7 @@ public class QuantityParamTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/param/ReferenceParamTest.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/param/ReferenceParamTest.java index a3d56e581c0..1fbb085d5d5 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/param/ReferenceParamTest.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/param/ReferenceParamTest.java @@ -300,7 +300,7 @@ public class ReferenceParamTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/param/TokenOrListParamDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/param/TokenOrListParamDstu3Test.java index fcd5cdc7dce..2481e4a2342 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/param/TokenOrListParamDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/param/TokenOrListParamDstu3Test.java @@ -27,7 +27,7 @@ public class TokenOrListParamDstu3Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/CreateBinaryDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/CreateBinaryDstu3Test.java index 45a715153f3..2cf05c1c35e 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/CreateBinaryDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/CreateBinaryDstu3Test.java @@ -1,11 +1,12 @@ package ca.uhn.fhir.rest.server; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; - -import java.util.concurrent.TimeUnit; - +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.rest.annotation.Create; +import ca.uhn.fhir.rest.annotation.ResourceParam; +import ca.uhn.fhir.rest.api.Constants; +import ca.uhn.fhir.rest.api.MethodOutcome; +import ca.uhn.fhir.test.utilities.JettyUtil; +import ca.uhn.fhir.util.TestUtil; import org.apache.commons.io.IOUtils; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; @@ -17,20 +18,20 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletHolder; -import org.hl7.fhir.dstu3.model.*; +import org.hl7.fhir.dstu3.model.Binary; +import org.hl7.fhir.dstu3.model.IdType; +import org.hl7.fhir.dstu3.model.Patient; import org.hl7.fhir.instance.model.api.IBaseResource; -import org.junit.jupiter.api.*; import static org.hamcrest.MatcherAssert.assertThat; - -import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.rest.annotation.Create; -import ca.uhn.fhir.rest.annotation.ResourceParam; -import ca.uhn.fhir.rest.api.Constants; -import ca.uhn.fhir.rest.api.MethodOutcome; -import ca.uhn.fhir.test.utilities.JettyUtil; -import ca.uhn.fhir.util.TestUtil; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.util.concurrent.TimeUnit; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; public class CreateBinaryDstu3Test { private static CloseableHttpClient ourClient; @@ -127,7 +128,7 @@ public class CreateBinaryDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/CreateDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/CreateDstu3Test.java index a2e3b428931..e0dae263c21 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/CreateDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/CreateDstu3Test.java @@ -211,7 +211,7 @@ public class CreateDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/CustomTypeServerDstu3.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/CustomTypeServerDstu3.java index 4593b5a45b5..49c9940f7a9 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/CustomTypeServerDstu3.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/CustomTypeServerDstu3.java @@ -27,10 +27,10 @@ import org.eclipse.jetty.servlet.ServletHolder; import org.hl7.fhir.dstu3.model.IdType; import org.hl7.fhir.dstu3.model.OperationOutcome; import org.hl7.fhir.dstu3.model.Patient; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.nio.charset.StandardCharsets; import java.util.ArrayList; @@ -129,7 +129,7 @@ public class CustomTypeServerDstu3 { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/DeleteConditionalDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/DeleteConditionalDstu3Test.java index 0a0b97bff25..26fc80d2b57 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/DeleteConditionalDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/DeleteConditionalDstu3Test.java @@ -18,10 +18,10 @@ import org.eclipse.jetty.servlet.ServletHolder; import org.hl7.fhir.dstu3.model.IdType; import org.hl7.fhir.dstu3.model.Patient; import org.hl7.fhir.instance.model.api.IBaseResource; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.util.concurrent.TimeUnit; @@ -83,7 +83,7 @@ public class DeleteConditionalDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/FormatParameterDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/FormatParameterDstu3Test.java index 48e704169ba..f9fb9b0cfb1 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/FormatParameterDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/FormatParameterDstu3Test.java @@ -1,9 +1,12 @@ package ca.uhn.fhir.rest.server; -import static org.junit.jupiter.api.Assertions.assertEquals; - -import java.util.concurrent.TimeUnit; - +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.model.api.annotation.ResourceDef; +import ca.uhn.fhir.rest.annotation.IdParam; +import ca.uhn.fhir.rest.annotation.Read; +import ca.uhn.fhir.rest.api.EncodingEnum; +import ca.uhn.fhir.test.utilities.JettyUtil; +import ca.uhn.fhir.util.TestUtil; import org.apache.commons.io.IOUtils; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; @@ -15,17 +18,13 @@ import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.hl7.fhir.dstu3.model.IdType; import org.hl7.fhir.dstu3.model.Patient; -import org.junit.jupiter.api.*; import static org.hamcrest.MatcherAssert.assertThat; - -import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.model.api.annotation.ResourceDef; -import ca.uhn.fhir.rest.annotation.IdParam; -import ca.uhn.fhir.rest.annotation.Read; -import ca.uhn.fhir.rest.api.EncodingEnum; -import ca.uhn.fhir.test.utilities.JettyUtil; -import ca.uhn.fhir.util.TestUtil; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import java.util.concurrent.TimeUnit; + +import static org.junit.jupiter.api.Assertions.assertEquals; public class FormatParameterDstu3Test { @@ -203,7 +202,7 @@ public class FormatParameterDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/InterceptorDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/InterceptorDstu3Test.java index 277c67fa6eb..c9e997c33e5 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/InterceptorDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/InterceptorDstu3Test.java @@ -43,11 +43,11 @@ import org.hl7.fhir.dstu3.model.OperationOutcome; import org.hl7.fhir.dstu3.model.Parameters; import org.hl7.fhir.dstu3.model.Patient; import org.hl7.fhir.instance.model.api.IBaseResource; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.InOrder; @@ -352,7 +352,7 @@ public class InterceptorDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/MetadataCapabilityStatementDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/MetadataCapabilityStatementDstu3Test.java index 5bc1aba18e1..0b0bc8b6782 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/MetadataCapabilityStatementDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/MetadataCapabilityStatementDstu3Test.java @@ -1,7 +1,6 @@ package ca.uhn.fhir.rest.server; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.rest.annotation.OptionalParam; import ca.uhn.fhir.rest.annotation.ResourceParam; import ca.uhn.fhir.rest.annotation.Search; @@ -192,7 +191,7 @@ public class MetadataCapabilityStatementDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/MetadataConformanceDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/MetadataConformanceDstu3Test.java index 27496c6b870..817c1f66ba4 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/MetadataConformanceDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/MetadataConformanceDstu3Test.java @@ -1,7 +1,6 @@ package ca.uhn.fhir.rest.server; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.rest.annotation.OptionalParam; import ca.uhn.fhir.rest.annotation.ResourceParam; import ca.uhn.fhir.rest.annotation.Search; @@ -160,7 +159,7 @@ public class MetadataConformanceDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/OperationServerDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/OperationServerDstu3Test.java index b5382da1516..75e16a9de2e 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/OperationServerDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/OperationServerDstu3Test.java @@ -25,14 +25,23 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletHolder; -import org.hl7.fhir.dstu3.model.*; +import org.hl7.fhir.dstu3.model.Bundle; +import org.hl7.fhir.dstu3.model.CapabilityStatement; import org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent; +import org.hl7.fhir.dstu3.model.IdType; +import org.hl7.fhir.dstu3.model.IntegerType; +import org.hl7.fhir.dstu3.model.Money; +import org.hl7.fhir.dstu3.model.OperationDefinition; import org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse; +import org.hl7.fhir.dstu3.model.Parameters; +import org.hl7.fhir.dstu3.model.Patient; +import org.hl7.fhir.dstu3.model.StringType; +import org.hl7.fhir.dstu3.model.UnsignedIntType; import org.hl7.fhir.instance.model.api.IBaseResource; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.nio.charset.StandardCharsets; import java.util.ArrayList; @@ -534,7 +543,7 @@ public class OperationServerDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/OperationServerWithSearchParamTypesDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/OperationServerWithSearchParamTypesDstu3Test.java index 3842f6ba77c..76335fec772 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/OperationServerWithSearchParamTypesDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/OperationServerWithSearchParamTypesDstu3Test.java @@ -36,10 +36,10 @@ import org.hl7.fhir.dstu3.model.Parameters; import org.hl7.fhir.dstu3.model.Patient; import org.hl7.fhir.dstu3.model.StringType; import org.hl7.fhir.instance.model.api.IBaseResource; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import javax.servlet.ServletConfig; import javax.servlet.http.HttpServletRequest; @@ -387,7 +387,7 @@ public class OperationServerWithSearchParamTypesDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll public static void beforeClass() throws Exception { diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/PatchServerDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/PatchServerDstu3Test.java index b31392c2737..03199db78a4 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/PatchServerDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/PatchServerDstu3Test.java @@ -193,7 +193,7 @@ public class PatchServerDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchBundleProviderWithNoSizeDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchBundleProviderWithNoSizeDstu3Test.java index 470d6b22b58..3675cb90c9b 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchBundleProviderWithNoSizeDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchBundleProviderWithNoSizeDstu3Test.java @@ -6,39 +6,20 @@ import ca.uhn.fhir.rest.api.server.IBundleProvider; import ca.uhn.fhir.rest.param.TokenAndListParam; import ca.uhn.fhir.test.utilities.JettyUtil; import ca.uhn.fhir.util.TestUtil; -import com.google.common.collect.Lists; -import org.apache.commons.io.IOUtils; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletHolder; -import org.hl7.fhir.dstu3.model.Bundle; -import org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent; import org.hl7.fhir.dstu3.model.Patient; import org.hl7.fhir.instance.model.api.IBaseResource; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.List; import java.util.concurrent.TimeUnit; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - public class SearchBundleProviderWithNoSizeDstu3Test { private static CloseableHttpClient ourClient; @@ -60,7 +41,7 @@ public class SearchBundleProviderWithNoSizeDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchCountParamDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchCountParamDstu3Test.java index 8d1c4e8c8ab..b3edc466493 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchCountParamDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchCountParamDstu3Test.java @@ -171,7 +171,7 @@ public class SearchCountParamDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchDefaultMethodDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchDefaultMethodDstu3Test.java index b8222400afa..ceb424dfcb4 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchDefaultMethodDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchDefaultMethodDstu3Test.java @@ -182,7 +182,7 @@ public class SearchDefaultMethodDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchDstu3Test.java index 894a99da1df..be6825b48e5 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchDstu3Test.java @@ -28,12 +28,11 @@ import org.hl7.fhir.dstu3.model.Bundle; import org.hl7.fhir.dstu3.model.HumanName; import org.hl7.fhir.dstu3.model.OperationOutcome; import org.hl7.fhir.dstu3.model.Patient; -import org.hl7.fhir.instance.model.api.IBaseOperationOutcome; import org.hl7.fhir.instance.model.api.IBaseResource; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.IOException; import java.nio.charset.StandardCharsets; @@ -321,7 +320,7 @@ public class SearchDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchHasParamDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchHasParamDstu3Test.java index 2a83794396b..17af852a1cf 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchHasParamDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchHasParamDstu3Test.java @@ -67,7 +67,7 @@ public class SearchHasParamDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchPostDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchPostDstu3Test.java index a1688692976..323e3f2276b 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchPostDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchPostDstu3Test.java @@ -27,10 +27,10 @@ import org.eclipse.jetty.servlet.ServletHolder; import org.hl7.fhir.dstu3.model.HumanName; import org.hl7.fhir.dstu3.model.Patient; import org.hl7.fhir.instance.model.api.IBaseResource; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -203,7 +203,7 @@ public class SearchPostDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchSortDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchSortDstu3Test.java index 485b8cb71de..e225ad2feb0 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchSortDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchSortDstu3Test.java @@ -77,7 +77,7 @@ public class SearchSortDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchWithGenericListDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchWithGenericListDstu3Test.java index baddb44d89e..96875620297 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchWithGenericListDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchWithGenericListDstu3Test.java @@ -66,7 +66,7 @@ public class SearchWithGenericListDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchWithIncludesDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchWithIncludesDstu3Test.java index 7fe9550776d..9a7d1db840b 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchWithIncludesDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchWithIncludesDstu3Test.java @@ -64,7 +64,7 @@ public class SearchWithIncludesDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchWithServerAddressStrategyDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchWithServerAddressStrategyDstu3Test.java index 285eee1ccc6..10ae6e87550 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchWithServerAddressStrategyDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/SearchWithServerAddressStrategyDstu3Test.java @@ -119,7 +119,7 @@ public class SearchWithServerAddressStrategyDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/ServerExceptionDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/ServerExceptionDstu3Test.java index eecd97d1a1e..420abfa011a 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/ServerExceptionDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/ServerExceptionDstu3Test.java @@ -231,7 +231,7 @@ public class ServerExceptionDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/ServerMimetypeDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/ServerMimetypeDstu3Test.java index 46dd7e913d9..258ecf21f3e 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/ServerMimetypeDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/ServerMimetypeDstu3Test.java @@ -45,7 +45,6 @@ import java.util.List; import java.util.concurrent.TimeUnit; import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.hasItems; import static org.hamcrest.Matchers.not; @@ -349,7 +348,7 @@ public class ServerMimetypeDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/ServerUsingOldTypesDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/ServerUsingOldTypesDstu3Test.java index 5fcaad53493..45e3a4ecb9b 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/ServerUsingOldTypesDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/ServerUsingOldTypesDstu3Test.java @@ -24,7 +24,7 @@ public class ServerUsingOldTypesDstu3Test { private static FhirContext ourCtx = FhirContext.forDstu3(); @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @Test diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/UnclassifiedServerExceptionDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/UnclassifiedServerExceptionDstu3Test.java index d525ce576a6..4e03d07bf6e 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/UnclassifiedServerExceptionDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/UnclassifiedServerExceptionDstu3Test.java @@ -64,7 +64,7 @@ public class UnclassifiedServerExceptionDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/UpdateDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/UpdateDstu3Test.java index 2c502404047..5f27eda98ed 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/UpdateDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/UpdateDstu3Test.java @@ -25,10 +25,10 @@ import org.hl7.fhir.dstu3.model.IdType; import org.hl7.fhir.dstu3.model.InstantType; import org.hl7.fhir.dstu3.model.OperationOutcome; import org.hl7.fhir.dstu3.model.Patient; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.nio.charset.StandardCharsets; import java.util.concurrent.TimeUnit; @@ -185,7 +185,7 @@ public class UpdateDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/ValidateDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/ValidateDstu3Test.java index e8eb67a5d06..c18f4175cee 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/ValidateDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/ValidateDstu3Test.java @@ -29,10 +29,10 @@ import org.hl7.fhir.dstu3.model.Organization; import org.hl7.fhir.dstu3.model.Parameters; import org.hl7.fhir.dstu3.model.Patient; import org.hl7.fhir.dstu3.model.StringType; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.util.concurrent.TimeUnit; @@ -246,7 +246,7 @@ public class ValidateDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/interceptor/BanUnsupprtedHttpMethodsInterceptorDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/interceptor/BanUnsupprtedHttpMethodsInterceptorDstu3Test.java index 58a362c99a8..a4296c69645 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/interceptor/BanUnsupprtedHttpMethodsInterceptorDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/interceptor/BanUnsupprtedHttpMethodsInterceptorDstu3Test.java @@ -131,7 +131,7 @@ public class BanUnsupprtedHttpMethodsInterceptorDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/interceptor/CorsInterceptorDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/interceptor/CorsInterceptorDstu3Test.java index 27c2656dcb3..5098740f1b5 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/interceptor/CorsInterceptorDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/interceptor/CorsInterceptorDstu3Test.java @@ -37,9 +37,9 @@ import org.hl7.fhir.dstu3.model.IdType; import org.hl7.fhir.dstu3.model.Identifier; import org.hl7.fhir.dstu3.model.Identifier.IdentifierUse; import org.hl7.fhir.dstu3.model.Patient; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import org.springframework.web.cors.CorsConfiguration; import java.io.IOException; @@ -160,7 +160,7 @@ public class CorsInterceptorDstu3Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/interceptor/auth/AuthorizationInterceptorDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/interceptor/auth/AuthorizationInterceptorDstu3Test.java index b0190dbe6d9..6d3a2777a34 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/interceptor/auth/AuthorizationInterceptorDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/interceptor/auth/AuthorizationInterceptorDstu3Test.java @@ -34,13 +34,24 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletHolder; -import org.hl7.fhir.dstu3.model.*; +import org.hl7.fhir.dstu3.model.Binary; +import org.hl7.fhir.dstu3.model.Bundle; +import org.hl7.fhir.dstu3.model.CarePlan; +import org.hl7.fhir.dstu3.model.DiagnosticReport; +import org.hl7.fhir.dstu3.model.IdType; +import org.hl7.fhir.dstu3.model.Observation; +import org.hl7.fhir.dstu3.model.Organization; +import org.hl7.fhir.dstu3.model.Parameters; +import org.hl7.fhir.dstu3.model.Patient; +import org.hl7.fhir.dstu3.model.Reference; +import org.hl7.fhir.dstu3.model.Resource; +import org.hl7.fhir.dstu3.model.ResourceType; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IIdType; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -251,7 +262,7 @@ public class AuthorizationInterceptorDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/util/XmlUtilDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/util/XmlUtilDstu3Test.java index 92cea006890..f05f71d6115 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/util/XmlUtilDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/util/XmlUtilDstu3Test.java @@ -4,10 +4,10 @@ import ca.uhn.fhir.context.ConfigurationException; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.parser.DataFormatException; import org.hl7.fhir.dstu3.model.Patient; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.w3c.dom.Document; import org.xml.sax.SAXException; @@ -99,7 +99,7 @@ public class XmlUtilDstu3Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-dstu3/src/test/java/org/hl7/fhir/dstu3/hapi/rest/server/ServerCapabilityStatementProviderDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/org/hl7/fhir/dstu3/hapi/rest/server/ServerCapabilityStatementProviderDstu3Test.java index 2074d19d5f2..257c1ba6ca9 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/org/hl7/fhir/dstu3/hapi/rest/server/ServerCapabilityStatementProviderDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/org/hl7/fhir/dstu3/hapi/rest/server/ServerCapabilityStatementProviderDstu3Test.java @@ -5,7 +5,21 @@ import ca.uhn.fhir.model.api.Include; import ca.uhn.fhir.model.api.annotation.Description; import ca.uhn.fhir.model.api.annotation.ResourceDef; import ca.uhn.fhir.model.primitive.InstantDt; -import ca.uhn.fhir.rest.annotation.*; +import ca.uhn.fhir.rest.annotation.ConditionalUrlParam; +import ca.uhn.fhir.rest.annotation.Create; +import ca.uhn.fhir.rest.annotation.Delete; +import ca.uhn.fhir.rest.annotation.History; +import ca.uhn.fhir.rest.annotation.IdParam; +import ca.uhn.fhir.rest.annotation.IncludeParam; +import ca.uhn.fhir.rest.annotation.Operation; +import ca.uhn.fhir.rest.annotation.OperationParam; +import ca.uhn.fhir.rest.annotation.OptionalParam; +import ca.uhn.fhir.rest.annotation.Read; +import ca.uhn.fhir.rest.annotation.RequiredParam; +import ca.uhn.fhir.rest.annotation.ResourceParam; +import ca.uhn.fhir.rest.annotation.Search; +import ca.uhn.fhir.rest.annotation.Update; +import ca.uhn.fhir.rest.annotation.Validate; import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.MethodOutcome; import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum; @@ -30,7 +44,8 @@ import ca.uhn.fhir.util.TestUtil; import ca.uhn.fhir.validation.FhirValidator; import ca.uhn.fhir.validation.ValidationResult; import com.google.common.collect.Lists; -import org.hl7.fhir.dstu3.model.*; +import org.hl7.fhir.dstu3.model.Bundle; +import org.hl7.fhir.dstu3.model.CapabilityStatement; import org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent; import org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent; import org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent; @@ -38,10 +53,18 @@ import org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResou import org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus; import org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction; import org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction; +import org.hl7.fhir.dstu3.model.CodeType; +import org.hl7.fhir.dstu3.model.DateType; +import org.hl7.fhir.dstu3.model.DiagnosticReport; +import org.hl7.fhir.dstu3.model.Encounter; import org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus; +import org.hl7.fhir.dstu3.model.IdType; +import org.hl7.fhir.dstu3.model.OperationDefinition; import org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent; import org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind; import org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse; +import org.hl7.fhir.dstu3.model.Patient; +import org.hl7.fhir.dstu3.model.StringType; import org.hl7.fhir.instance.model.api.IBaseResource; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Disabled; @@ -1157,7 +1180,7 @@ public class ServerCapabilityStatementProviderDstu3Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } public static class ProfiledPatientProvider implements IResourceProvider { diff --git a/hapi-fhir-structures-dstu3/src/test/java/org/hl7/fhir/dstu3/model/BaseDateTimeTypeDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/org/hl7/fhir/dstu3/model/BaseDateTimeTypeDstu3Test.java index cbce6e5b7a8..89888e5766f 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/org/hl7/fhir/dstu3/model/BaseDateTimeTypeDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/org/hl7/fhir/dstu3/model/BaseDateTimeTypeDstu3Test.java @@ -7,12 +7,11 @@ import ca.uhn.fhir.util.TestUtil; import ca.uhn.fhir.validation.ValidationResult; import org.apache.commons.lang3.time.FastDateFormat; import org.hamcrest.Matchers; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import javax.xml.crypto.Data; import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.time.ZoneOffset; @@ -927,7 +926,7 @@ public class BaseDateTimeTypeDstu3Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserHl7OrgDstu2Test.java b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserHl7OrgDstu2Test.java index 06fbc26bfe7..610d3942840 100644 --- a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserHl7OrgDstu2Test.java +++ b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserHl7OrgDstu2Test.java @@ -11,25 +11,48 @@ import org.apache.commons.io.IOUtils; import org.hamcrest.core.IsNot; import org.hamcrest.core.StringContains; import org.hamcrest.text.StringContainsInOrder; -import org.hl7.fhir.dstu2.model.*; +import org.hl7.fhir.dstu2.model.Address; import org.hl7.fhir.dstu2.model.Address.AddressUse; import org.hl7.fhir.dstu2.model.Address.AddressUseEnumFactory; +import org.hl7.fhir.dstu2.model.Binary; +import org.hl7.fhir.dstu2.model.Bundle; import org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent; +import org.hl7.fhir.dstu2.model.CodeableConcept; +import org.hl7.fhir.dstu2.model.Conformance; import org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode; +import org.hl7.fhir.dstu2.model.DateTimeType; +import org.hl7.fhir.dstu2.model.DateType; +import org.hl7.fhir.dstu2.model.DecimalType; +import org.hl7.fhir.dstu2.model.DiagnosticReport; +import org.hl7.fhir.dstu2.model.EnumFactory; +import org.hl7.fhir.dstu2.model.Enumeration; +import org.hl7.fhir.dstu2.model.Extension; +import org.hl7.fhir.dstu2.model.HumanName; import org.hl7.fhir.dstu2.model.Identifier.IdentifierUse; +import org.hl7.fhir.dstu2.model.InstantType; +import org.hl7.fhir.dstu2.model.List_; import org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus; +import org.hl7.fhir.dstu2.model.Observation; +import org.hl7.fhir.dstu2.model.Organization; +import org.hl7.fhir.dstu2.model.Patient; import org.hl7.fhir.dstu2.model.Patient.ContactComponent; +import org.hl7.fhir.dstu2.model.PrimitiveType; +import org.hl7.fhir.dstu2.model.QuestionnaireResponse; import org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent; +import org.hl7.fhir.dstu2.model.Reference; +import org.hl7.fhir.dstu2.model.Specimen; +import org.hl7.fhir.dstu2.model.StringType; +import org.hl7.fhir.dstu2.model.ValueSet; import org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent; import org.hl7.fhir.dstu2.model.ValueSet.ValueSetCodeSystemComponent; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IPrimitiveType; import org.hl7.fhir.utilities.xhtml.XhtmlNode; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; import java.io.IOException; @@ -61,7 +84,7 @@ public class JsonParserHl7OrgDstu2Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @Test diff --git a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationTestHl7OrgDstu2.java b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationTestHl7OrgDstu2.java index 6981c9b3d57..4e10ccc2f44 100644 --- a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationTestHl7OrgDstu2.java +++ b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationTestHl7OrgDstu2.java @@ -144,6 +144,6 @@ public class ClientServerValidationTestHl7OrgDstu2 { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchWithGenericListHl7OrgDstu2Test.java b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchWithGenericListHl7OrgDstu2Test.java index b4e2b56c479..af3acf25d3d 100644 --- a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchWithGenericListHl7OrgDstu2Test.java +++ b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchWithGenericListHl7OrgDstu2Test.java @@ -87,7 +87,7 @@ public class SearchWithGenericListHl7OrgDstu2Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/narrative/DefaultThymeleafNarrativeGeneratorR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/narrative/DefaultThymeleafNarrativeGeneratorR4Test.java index b67f5e6ba3c..178e09ff654 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/narrative/DefaultThymeleafNarrativeGeneratorR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/narrative/DefaultThymeleafNarrativeGeneratorR4Test.java @@ -250,7 +250,7 @@ public class DefaultThymeleafNarrativeGeneratorR4Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/parser/CustomTypeR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/parser/CustomTypeR4Test.java index 5f2295649f4..004fc0d1a33 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/parser/CustomTypeR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/parser/CustomTypeR4Test.java @@ -11,7 +11,6 @@ import ca.uhn.fhir.model.primitive.StringDt; import ca.uhn.fhir.parser.CustomResource364R4.CustomResource364CustomDate; import ca.uhn.fhir.util.ElementUtil; import ca.uhn.fhir.util.TestUtil; -import org.hl7.fhir.instance.model.api.IBase; import org.hl7.fhir.r4.model.Bundle; import org.hl7.fhir.r4.model.DateTimeType; import org.hl7.fhir.r4.model.Medication; @@ -21,9 +20,9 @@ import org.hl7.fhir.r4.model.Period; import org.hl7.fhir.r4.model.Quantity; import org.hl7.fhir.r4.model.StringType; import org.hl7.fhir.r4.model.Type; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.List; @@ -47,7 +46,7 @@ public class CustomTypeR4Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @ResourceDef diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/parser/ElementWithExtensionR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/parser/ElementWithExtensionR4Test.java index f2db6d3a8bb..ddca911b043 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/parser/ElementWithExtensionR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/parser/ElementWithExtensionR4Test.java @@ -24,7 +24,7 @@ public class ElementWithExtensionR4Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @Test diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/parser/JsonParserR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/parser/JsonParserR4Test.java index 76d5108d814..0960c9e605e 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/parser/JsonParserR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/parser/JsonParserR4Test.java @@ -1006,7 +1006,7 @@ public class JsonParserR4Test extends BaseTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/parser/RDFParserR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/parser/RDFParserR4Test.java index 1f1eaf920c0..068fa36c9c0 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/parser/RDFParserR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/parser/RDFParserR4Test.java @@ -285,7 +285,7 @@ public class RDFParserR4Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/parser/jsonlike/JsonLikeParserTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/parser/jsonlike/JsonLikeParserTest.java index d8e541400bf..41e744dafa3 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/parser/jsonlike/JsonLikeParserTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/parser/jsonlike/JsonLikeParserTest.java @@ -154,7 +154,7 @@ public class JsonLikeParserTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/parser/view/ViewGeneratorTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/parser/view/ViewGeneratorTest.java index 1fafcb14b02..8054b43efb5 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/parser/view/ViewGeneratorTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/parser/view/ViewGeneratorTest.java @@ -20,7 +20,7 @@ public class ViewGeneratorTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @Test diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/BaseGenericClientR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/BaseGenericClientR4Test.java index f355f520766..cf0e1e344af 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/BaseGenericClientR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/BaseGenericClientR4Test.java @@ -134,7 +134,7 @@ public abstract class BaseGenericClientR4Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/BasicAuthInterceptorTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/BasicAuthInterceptorTest.java index cdfea7204cb..15089f401f7 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/BasicAuthInterceptorTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/BasicAuthInterceptorTest.java @@ -14,10 +14,10 @@ import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.message.BasicHeader; import org.apache.http.message.BasicStatusLine; import org.hl7.fhir.r4.model.IdType; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; @@ -102,7 +102,7 @@ public class BasicAuthInterceptorTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/BearerTokenAuthInterceptorTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/BearerTokenAuthInterceptorTest.java index 124e96bc156..93631632f91 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/BearerTokenAuthInterceptorTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/BearerTokenAuthInterceptorTest.java @@ -1,31 +1,32 @@ package ca.uhn.fhir.rest.client; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.io.StringReader; -import java.nio.charset.Charset; - -import org.apache.commons.io.input.ReaderInputStream; -import org.apache.http.*; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.HttpUriRequest; -import org.apache.http.message.BasicHeader; -import org.apache.http.message.BasicStatusLine; -import org.hl7.fhir.r4.model.IdType; -import org.junit.jupiter.api.*; import static org.hamcrest.MatcherAssert.assertThat; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; -import org.mockito.ArgumentCaptor; -import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; - import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum; import ca.uhn.fhir.rest.client.interceptor.BearerTokenAuthInterceptor; import ca.uhn.fhir.util.TestUtil; +import org.apache.commons.io.input.ReaderInputStream; +import org.apache.http.Header; +import org.apache.http.HttpResponse; +import org.apache.http.ProtocolVersion; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.message.BasicHeader; +import org.apache.http.message.BasicStatusLine; +import org.hl7.fhir.r4.model.IdType; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; + +import java.io.StringReader; +import java.nio.charset.Charset; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; /** * Created by dsotnikov on 2/25/2014. @@ -89,7 +90,7 @@ public class BearerTokenAuthInterceptorTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/BinaryClientTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/BinaryClientTest.java index 8be534bc3eb..24749141df2 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/BinaryClientTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/BinaryClientTest.java @@ -1,36 +1,41 @@ package ca.uhn.fhir.rest.client; -import static org.hamcrest.CoreMatchers.containsString; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.jupiter.api.Assertions.*; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.io.ByteArrayInputStream; - -import com.google.common.base.Charsets; -import org.apache.commons.io.IOUtils; -import org.apache.http.HttpResponse; -import org.apache.http.ProtocolVersion; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.*; -import org.apache.http.message.BasicHeader; -import org.apache.http.message.BasicStatusLine; -import org.hl7.fhir.r4.model.Binary; -import org.hl7.fhir.r4.model.IdType; -import org.junit.jupiter.api.*; import static org.hamcrest.MatcherAssert.assertThat; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeEach; -import org.mockito.ArgumentCaptor; -import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; - import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.rest.annotation.*; +import ca.uhn.fhir.rest.annotation.Create; +import ca.uhn.fhir.rest.annotation.IdParam; +import ca.uhn.fhir.rest.annotation.Read; +import ca.uhn.fhir.rest.annotation.ResourceParam; import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.MethodOutcome; import ca.uhn.fhir.rest.client.api.IBasicClient; import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum; import ca.uhn.fhir.util.TestUtil; +import com.google.common.base.Charsets; +import org.apache.commons.io.IOUtils; +import org.apache.http.HttpResponse; +import org.apache.http.ProtocolVersion; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.message.BasicHeader; +import org.apache.http.message.BasicStatusLine; +import org.hl7.fhir.r4.model.Binary; +import org.hl7.fhir.r4.model.IdType; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; + +import java.io.ByteArrayInputStream; + +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; public class BinaryClientTest { @@ -130,7 +135,7 @@ public class BinaryClientTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ClientHeadersR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ClientHeadersR4Test.java index a655c59e6c7..e14028ac170 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ClientHeadersR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ClientHeadersR4Test.java @@ -168,7 +168,7 @@ public class ClientHeadersR4Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ClientIntegrationTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ClientIntegrationTest.java index 9a90af0a38d..fe78ecb8004 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ClientIntegrationTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ClientIntegrationTest.java @@ -17,10 +17,10 @@ import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.hl7.fhir.r4.model.Patient; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -117,7 +117,7 @@ public class ClientIntegrationTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ClientMimetypeR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ClientMimetypeR4Test.java index 10ed0d3fed1..5cef1ff5ac3 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ClientMimetypeR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ClientMimetypeR4Test.java @@ -19,10 +19,10 @@ import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.message.BasicHeader; import org.apache.http.message.BasicStatusLine; import org.hl7.fhir.r4.model.Patient; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; import org.mockito.invocation.InvocationOnMock; @@ -164,7 +164,7 @@ public class ClientMimetypeR4Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ClientR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ClientR4Test.java index 874b56d657c..e8719944c63 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ClientR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ClientR4Test.java @@ -25,7 +25,16 @@ import ca.uhn.fhir.rest.client.api.IRestfulClient; import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum; import ca.uhn.fhir.rest.client.exceptions.FhirClientConnectionException; import ca.uhn.fhir.rest.client.interceptor.CapturingInterceptor; -import ca.uhn.fhir.rest.param.*; +import ca.uhn.fhir.rest.param.CompositeParam; +import ca.uhn.fhir.rest.param.DateParam; +import ca.uhn.fhir.rest.param.DateRangeParam; +import ca.uhn.fhir.rest.param.ParamPrefixEnum; +import ca.uhn.fhir.rest.param.QuantityParam; +import ca.uhn.fhir.rest.param.StringAndListParam; +import ca.uhn.fhir.rest.param.StringOrListParam; +import ca.uhn.fhir.rest.param.StringParam; +import ca.uhn.fhir.rest.param.TokenOrListParam; +import ca.uhn.fhir.rest.param.TokenParam; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException; @@ -51,8 +60,17 @@ import org.hamcrest.core.StringContains; import org.hamcrest.core.StringEndsWith; import org.hl7.fhir.instance.model.api.IBaseBundle; import org.hl7.fhir.instance.model.api.IBaseResource; -import org.hl7.fhir.r4.model.*; +import org.hl7.fhir.r4.model.Bundle; import org.hl7.fhir.r4.model.Bundle.BundleEntryComponent; +import org.hl7.fhir.r4.model.CapabilityStatement; +import org.hl7.fhir.r4.model.Coding; +import org.hl7.fhir.r4.model.IdType; +import org.hl7.fhir.r4.model.InstantType; +import org.hl7.fhir.r4.model.IntegerType; +import org.hl7.fhir.r4.model.Observation; +import org.hl7.fhir.r4.model.OperationOutcome; +import org.hl7.fhir.r4.model.Organization; +import org.hl7.fhir.r4.model.Patient; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -1574,7 +1592,7 @@ public class ClientR4Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } private static String getPatientFeedWithOneResult() { diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ClientWithCustomTypeR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ClientWithCustomTypeR4Test.java index c6464e509e9..02c3ff732ce 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ClientWithCustomTypeR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ClientWithCustomTypeR4Test.java @@ -19,10 +19,10 @@ import org.hl7.fhir.instance.model.api.IAnyResource; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.r4.model.Bundle; import org.hl7.fhir.r4.model.Organization; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; import org.mockito.invocation.InvocationOnMock; @@ -43,7 +43,7 @@ public class ClientWithCustomTypeR4Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeEach diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/CompressOutgoingContentInterceptorTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/CompressOutgoingContentInterceptorTest.java index 394c1177b63..e24883f5696 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/CompressOutgoingContentInterceptorTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/CompressOutgoingContentInterceptorTest.java @@ -60,7 +60,7 @@ public class CompressOutgoingContentInterceptorTest { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ExceptionHandlingTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ExceptionHandlingTest.java index f39ba53e53d..36a5c63be32 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ExceptionHandlingTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ExceptionHandlingTest.java @@ -20,10 +20,10 @@ import org.hamcrest.core.StringContains; import org.hl7.fhir.r4.model.IdType; import org.hl7.fhir.r4.model.OperationOutcome; import org.hl7.fhir.r4.model.Patient; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; @@ -191,7 +191,7 @@ public class ExceptionHandlingTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/HttpProxyTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/HttpProxyTest.java index 95b437fc60c..999a8ce2cc3 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/HttpProxyTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/HttpProxyTest.java @@ -15,9 +15,9 @@ import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.hl7.fhir.r4.model.IdType; import org.hl7.fhir.r4.model.Patient; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; @@ -143,7 +143,7 @@ public class HttpProxyTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/IncludedResourceStitchingClientTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/IncludedResourceStitchingClientTest.java index 950af74db06..7b233a5436a 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/IncludedResourceStitchingClientTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/IncludedResourceStitchingClientTest.java @@ -20,14 +20,13 @@ import org.hl7.fhir.r4.model.Extension; import org.hl7.fhir.r4.model.Organization; import org.hl7.fhir.r4.model.Patient; import org.hl7.fhir.r4.model.Reference; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; import java.io.StringReader; -import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.List; @@ -303,7 +302,7 @@ public class IncludedResourceStitchingClientTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/LoggingInterceptorTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/LoggingInterceptorTest.java index 9f72f557376..389cd2d9b2c 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/LoggingInterceptorTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/LoggingInterceptorTest.java @@ -21,11 +21,11 @@ import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.hl7.fhir.r4.model.IdType; import org.hl7.fhir.r4.model.Patient; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentMatcher; import org.slf4j.LoggerFactory; @@ -133,7 +133,7 @@ public class LoggingInterceptorTest { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/NonGenericClientR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/NonGenericClientR4Test.java index 46f5f15ddf7..035b09841b5 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/NonGenericClientR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/NonGenericClientR4Test.java @@ -28,10 +28,10 @@ import org.hl7.fhir.r4.model.Bundle; import org.hl7.fhir.r4.model.IdType; import org.hl7.fhir.r4.model.OperationOutcome; import org.hl7.fhir.r4.model.Patient; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; import org.mockito.invocation.InvocationOnMock; @@ -167,7 +167,7 @@ public class NonGenericClientR4Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/OperationClientR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/OperationClientR4Test.java index 340cdaa41ba..3176f77c40f 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/OperationClientR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/OperationClientR4Test.java @@ -225,6 +225,6 @@ public class OperationClientR4Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/PatchClientR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/PatchClientR4Test.java index e7f7ba16a78..ce3d64ed06a 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/PatchClientR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/PatchClientR4Test.java @@ -129,7 +129,7 @@ public class PatchClientR4Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ReferenceClientTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ReferenceClientTest.java index c34ab745ce0..50b4b509513 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ReferenceClientTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ReferenceClientTest.java @@ -18,9 +18,9 @@ import org.apache.http.message.BasicHeader; import org.apache.http.message.BasicStatusLine; import org.hl7.fhir.r4.model.Bundle; import org.hl7.fhir.r4.model.Patient; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; @@ -130,7 +130,7 @@ public class ReferenceClientTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/SearchClientR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/SearchClientR4Test.java index d60a32935db..d22d3b4c348 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/SearchClientR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/SearchClientR4Test.java @@ -1,14 +1,20 @@ package ca.uhn.fhir.rest.client; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.io.InputStream; -import java.io.StringReader; -import java.nio.charset.Charset; -import java.util.*; - +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.rest.annotation.Count; +import ca.uhn.fhir.rest.annotation.OptionalParam; +import ca.uhn.fhir.rest.annotation.RequiredParam; +import ca.uhn.fhir.rest.annotation.Search; +import ca.uhn.fhir.rest.annotation.Sort; +import ca.uhn.fhir.rest.api.Constants; +import ca.uhn.fhir.rest.api.SortOrderEnum; +import ca.uhn.fhir.rest.api.SortSpec; +import ca.uhn.fhir.rest.client.api.IGenericClient; +import ca.uhn.fhir.rest.client.api.IRestfulClient; +import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum; +import ca.uhn.fhir.rest.param.StringParam; +import ca.uhn.fhir.util.TestUtil; +import ca.uhn.fhir.util.UrlUtil; import org.apache.commons.io.input.ReaderInputStream; import org.apache.http.HttpResponse; import org.apache.http.ProtocolVersion; @@ -17,26 +23,32 @@ import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.message.BasicHeader; import org.apache.http.message.BasicStatusLine; -import org.hl7.fhir.r4.model.*; +import org.hl7.fhir.r4.model.Bundle; import org.hl7.fhir.r4.model.Bundle.BundleEntryComponent; -import org.junit.jupiter.api.*; import static org.hamcrest.MatcherAssert.assertThat; +import org.hl7.fhir.r4.model.CapabilityStatement; +import org.hl7.fhir.r4.model.Extension; +import org.hl7.fhir.r4.model.Location; +import org.hl7.fhir.r4.model.StringType; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; -import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.rest.annotation.*; -import ca.uhn.fhir.rest.annotation.Count; -import ca.uhn.fhir.rest.api.Constants; -import ca.uhn.fhir.rest.api.SortOrderEnum; -import ca.uhn.fhir.rest.api.SortSpec; -import ca.uhn.fhir.rest.client.api.*; -import ca.uhn.fhir.rest.param.StringParam; -import ca.uhn.fhir.util.TestUtil; -import ca.uhn.fhir.util.UrlUtil; +import java.io.InputStream; +import java.io.StringReader; +import java.nio.charset.Charset; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.List; +import java.util.TimeZone; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; public class SearchClientR4Test { @@ -234,7 +246,7 @@ public class SearchClientR4Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } public interface ILocationClient extends IRestfulClient { diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/SearchClientTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/SearchClientTest.java index 7004dfc3fd5..0d37d137d0d 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/SearchClientTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/SearchClientTest.java @@ -166,7 +166,7 @@ public class SearchClientTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/SortClientTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/SortClientTest.java index b3b2c645eb6..8dcdccc5542 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/SortClientTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/SortClientTest.java @@ -21,9 +21,9 @@ import org.apache.http.message.BasicHeader; import org.apache.http.message.BasicStatusLine; import org.hl7.fhir.r4.model.Bundle; import org.hl7.fhir.r4.model.Patient; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; @@ -103,7 +103,7 @@ public class SortClientTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/StringClientTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/StringClientTest.java index aad3f3bd54f..d39652287d8 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/StringClientTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/StringClientTest.java @@ -1,14 +1,13 @@ package ca.uhn.fhir.rest.client; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.io.StringReader; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.util.List; - +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.rest.annotation.RequiredParam; +import ca.uhn.fhir.rest.annotation.Search; +import ca.uhn.fhir.rest.api.Constants; +import ca.uhn.fhir.rest.client.api.IBasicClient; +import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum; +import ca.uhn.fhir.rest.param.StringParam; +import ca.uhn.fhir.util.TestUtil; import org.apache.commons.io.input.ReaderInputStream; import org.apache.http.HttpResponse; import org.apache.http.ProtocolVersion; @@ -19,20 +18,19 @@ import org.apache.http.message.BasicHeader; import org.apache.http.message.BasicStatusLine; import org.hl7.fhir.r4.model.Bundle; import org.hl7.fhir.r4.model.Patient; -import org.junit.jupiter.api.*; import static org.hamcrest.MatcherAssert.assertThat; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; -import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.rest.annotation.RequiredParam; -import ca.uhn.fhir.rest.annotation.Search; -import ca.uhn.fhir.rest.api.Constants; -import ca.uhn.fhir.rest.client.api.IBasicClient; -import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum; -import ca.uhn.fhir.rest.param.StringParam; -import ca.uhn.fhir.util.TestUtil; +import java.io.StringReader; +import java.nio.charset.StandardCharsets; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; public class StringClientTest { @@ -120,7 +118,7 @@ public class StringClientTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ThreadLocalCapturingInterceptorR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ThreadLocalCapturingInterceptorR4Test.java index a179a74dc12..df129486b83 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ThreadLocalCapturingInterceptorR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ThreadLocalCapturingInterceptorR4Test.java @@ -162,7 +162,7 @@ public class ThreadLocalCapturingInterceptorR4Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/TransactionClientTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/TransactionClientTest.java index 00d5bc0a9c2..e3cfe49f481 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/TransactionClientTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/TransactionClientTest.java @@ -21,9 +21,9 @@ import org.hl7.fhir.r4.model.IdType; import org.hl7.fhir.r4.model.Observation; import org.hl7.fhir.r4.model.Patient; import org.hl7.fhir.r4.model.Reference; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; @@ -155,7 +155,7 @@ public class TransactionClientTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/interceptor/AdditionalHeadersInterceptorTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/interceptor/AdditionalHeadersInterceptorTest.java index c0277c8e452..86ce92465f9 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/interceptor/AdditionalHeadersInterceptorTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/interceptor/AdditionalHeadersInterceptorTest.java @@ -111,7 +111,7 @@ public class AdditionalHeadersInterceptorTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/param/DateRangeParamR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/param/DateRangeParamR4Test.java index a84638d5ef6..b78d8afba58 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/param/DateRangeParamR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/param/DateRangeParamR4Test.java @@ -24,7 +24,6 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletHolder; -import org.hamcrest.Matchers; import org.hl7.fhir.r4.model.Patient; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; @@ -40,7 +39,6 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; -import java.util.Locale; import java.util.TimeZone; import java.util.concurrent.TimeUnit; @@ -49,7 +47,6 @@ import static ca.uhn.fhir.rest.param.ParamPrefixEnum.GREATERTHAN_OR_EQUALS; import static ca.uhn.fhir.rest.param.ParamPrefixEnum.LESSTHAN_OR_EQUALS; import static java.lang.System.currentTimeMillis; import static java.util.concurrent.TimeUnit.SECONDS; -import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -455,7 +452,7 @@ public class DateRangeParamR4Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/BinaryServerR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/BinaryServerR4Test.java index e7db28a039b..c507eb82aca 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/BinaryServerR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/BinaryServerR4Test.java @@ -233,7 +233,7 @@ public class BinaryServerR4Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/CreateR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/CreateR4Test.java index 40b955a6e7f..7713d7779b3 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/CreateR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/CreateR4Test.java @@ -31,11 +31,11 @@ import org.hl7.fhir.r4.model.IdType; import org.hl7.fhir.r4.model.OperationOutcome; import org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent; import org.hl7.fhir.r4.model.Patient; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.nio.charset.StandardCharsets; import java.util.ArrayList; @@ -408,7 +408,7 @@ public class CreateR4Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/CustomTypeServerR4.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/CustomTypeServerR4.java index 43e437667e1..3a22e18df5e 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/CustomTypeServerR4.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/CustomTypeServerR4.java @@ -27,10 +27,10 @@ import org.eclipse.jetty.servlet.ServletHolder; import org.hl7.fhir.r4.model.IdType; import org.hl7.fhir.r4.model.OperationOutcome; import org.hl7.fhir.r4.model.Patient; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.nio.charset.StandardCharsets; import java.util.ArrayList; @@ -129,7 +129,7 @@ public class CustomTypeServerR4 { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/DeleteConditionalR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/DeleteConditionalR4Test.java index 536540bcad8..edbbb0b25be 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/DeleteConditionalR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/DeleteConditionalR4Test.java @@ -85,7 +85,7 @@ public class DeleteConditionalR4Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/ElementsParamR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/ElementsParamR4Test.java index 02309b649cd..b4a6e2b015a 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/ElementsParamR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/ElementsParamR4Test.java @@ -2,8 +2,13 @@ package ca.uhn.fhir.rest.server; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.model.api.Include; -import ca.uhn.fhir.rest.annotation.*; +import ca.uhn.fhir.rest.annotation.Elements; +import ca.uhn.fhir.rest.annotation.IdParam; +import ca.uhn.fhir.rest.annotation.IncludeParam; +import ca.uhn.fhir.rest.annotation.Read; +import ca.uhn.fhir.rest.annotation.Search; import ca.uhn.fhir.rest.api.EncodingEnum; +import ca.uhn.fhir.test.utilities.JettyUtil; import ca.uhn.fhir.util.TestUtil; import com.google.common.base.Charsets; import org.apache.commons.io.IOUtils; @@ -16,8 +21,20 @@ import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.hl7.fhir.instance.model.api.IBaseResource; -import org.hl7.fhir.r4.model.*; -import org.junit.jupiter.api.*; import static org.hamcrest.MatcherAssert.assertThat; +import org.hl7.fhir.r4.model.Bundle; +import org.hl7.fhir.r4.model.DiagnosticReport; +import org.hl7.fhir.r4.model.IdType; +import org.hl7.fhir.r4.model.Observation; +import org.hl7.fhir.r4.model.Patient; +import org.hl7.fhir.r4.model.Procedure; +import org.hl7.fhir.r4.model.Quantity; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.StringType; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import java.io.IOException; import java.util.Collection; @@ -25,15 +42,11 @@ import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.function.Consumer; -import static org.hamcrest.Matchers.*; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.hamcrest.MatcherAssert.assertThat; - -import ca.uhn.fhir.test.utilities.JettyUtil; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.not; +import static org.junit.jupiter.api.Assertions.assertEquals; public class ElementsParamR4Test { @@ -495,7 +508,7 @@ public class ElementsParamR4Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/GraphQLR4RawTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/GraphQLR4RawTest.java index f099b1abafc..2b1a827b3bc 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/GraphQLR4RawTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/GraphQLR4RawTest.java @@ -2,8 +2,8 @@ package ca.uhn.fhir.rest.server; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.rest.annotation.GraphQL; -import ca.uhn.fhir.rest.annotation.GraphQLQueryUrl; import ca.uhn.fhir.rest.annotation.GraphQLQueryBody; +import ca.uhn.fhir.rest.annotation.GraphQLQueryUrl; import ca.uhn.fhir.rest.annotation.IdParam; import ca.uhn.fhir.rest.annotation.OptionalParam; import ca.uhn.fhir.rest.annotation.Search; @@ -60,7 +60,7 @@ public class GraphQLR4RawTest { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/HistoryR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/HistoryR4Test.java index 6ac3f56f0f9..6764e39cee8 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/HistoryR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/HistoryR4Test.java @@ -186,7 +186,7 @@ public class HistoryR4Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/IncludeTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/IncludeTest.java index 8e662c7a95f..bea32a32981 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/IncludeTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/IncludeTest.java @@ -479,7 +479,7 @@ public class IncludeTest { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/MultitenancyR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/MultitenancyR4Test.java index d1771fb6268..846d271f51c 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/MultitenancyR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/MultitenancyR4Test.java @@ -111,7 +111,7 @@ public class MultitenancyR4Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/OperationGenericServer2R4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/OperationGenericServer2R4Test.java index 00b4e7f9e03..57650e49b9e 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/OperationGenericServer2R4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/OperationGenericServer2R4Test.java @@ -32,11 +32,11 @@ import org.hl7.fhir.r4.model.Parameters; import org.hl7.fhir.r4.model.Patient; import org.hl7.fhir.r4.model.StringType; import org.hl7.fhir.r4.model.UriType; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import javax.servlet.ServletException; import java.nio.charset.StandardCharsets; @@ -304,7 +304,7 @@ public class OperationGenericServer2R4Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/OperationGenericServerR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/OperationGenericServerR4Test.java index c7520d06518..999e7ffc1ae 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/OperationGenericServerR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/OperationGenericServerR4Test.java @@ -276,7 +276,7 @@ public class OperationGenericServerR4Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/OperationServerR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/OperationServerR4Test.java index 84cfb5b1038..ad4f75cbc6b 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/OperationServerR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/OperationServerR4Test.java @@ -1002,7 +1002,7 @@ public class OperationServerR4Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/PagingUsingNamedPagesR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/PagingUsingNamedPagesR4Test.java index 29a88e044e2..6a05c7f0ff2 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/PagingUsingNamedPagesR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/PagingUsingNamedPagesR4Test.java @@ -198,7 +198,7 @@ public class PagingUsingNamedPagesR4Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/PlainProviderR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/PlainProviderR4Test.java index a2fc8681e0d..1a11ebd4cfd 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/PlainProviderR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/PlainProviderR4Test.java @@ -171,7 +171,7 @@ public class PlainProviderR4Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } private static Organization createOrganization() { diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/PreferTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/PreferTest.java index 365df2ef5f9..45891b4d569 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/PreferTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/PreferTest.java @@ -163,7 +163,7 @@ public class PreferTest { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/SearchBundleProviderWithNoSizeR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/SearchBundleProviderWithNoSizeR4Test.java index 53e51ee9bfb..ffebab8c3a6 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/SearchBundleProviderWithNoSizeR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/SearchBundleProviderWithNoSizeR4Test.java @@ -20,10 +20,10 @@ import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.r4.model.Bundle; import org.hl7.fhir.r4.model.Bundle.BundleLinkComponent; import org.hl7.fhir.r4.model.Patient; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; @@ -144,7 +144,7 @@ public class SearchBundleProviderWithNoSizeR4Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/SearchHasParamR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/SearchHasParamR4Test.java index 7110cc46584..3235d7342e4 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/SearchHasParamR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/SearchHasParamR4Test.java @@ -21,10 +21,10 @@ import org.eclipse.jetty.servlet.ServletHolder; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.r4.model.HumanName; import org.hl7.fhir.r4.model.Patient; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.List; @@ -68,7 +68,7 @@ public class SearchHasParamR4Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/SearchSearchServerR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/SearchSearchServerR4Test.java index df20fcdd4f7..1f94b321f79 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/SearchSearchServerR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/SearchSearchServerR4Test.java @@ -44,10 +44,10 @@ import org.hl7.fhir.r4.model.Bundle; import org.hl7.fhir.r4.model.IdType; import org.hl7.fhir.r4.model.Observation; import org.hl7.fhir.r4.model.Patient; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.Collections; @@ -491,7 +491,7 @@ public class SearchSearchServerR4Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/SearchSortR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/SearchSortR4Test.java index 52b5ba98960..de38b5e2900 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/SearchSortR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/SearchSortR4Test.java @@ -19,10 +19,10 @@ import org.eclipse.jetty.servlet.ServletHolder; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.r4.model.HumanName; import org.hl7.fhir.r4.model.Patient; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.List; @@ -77,7 +77,7 @@ public class SearchSortR4Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/ServerMimetypeR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/ServerMimetypeR4Test.java index 7c1406fa6c6..6544b49186c 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/ServerMimetypeR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/ServerMimetypeR4Test.java @@ -47,7 +47,6 @@ import java.util.List; import java.util.concurrent.TimeUnit; import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.hasItems; import static org.hamcrest.Matchers.not; @@ -455,7 +454,7 @@ public class ServerMimetypeR4Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/SummaryParamR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/SummaryParamR4Test.java index 8eaf3b993a3..155a8c89825 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/SummaryParamR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/SummaryParamR4Test.java @@ -374,7 +374,7 @@ public class SummaryParamR4Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/exceptions/ExceptionPropertiesTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/exceptions/ExceptionPropertiesTest.java index 8766e65528e..dc99ae2796e 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/exceptions/ExceptionPropertiesTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/exceptions/ExceptionPropertiesTest.java @@ -93,7 +93,7 @@ public class ExceptionPropertiesTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/ExceptionHandlingInterceptorTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/ExceptionHandlingInterceptorTest.java index cc0edbb3de9..6fba330f118 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/ExceptionHandlingInterceptorTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/ExceptionHandlingInterceptorTest.java @@ -98,7 +98,7 @@ public class ExceptionHandlingInterceptorTest { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll public static void beforeClass() throws Exception { diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/ExceptionInterceptorMethodTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/ExceptionInterceptorMethodTest.java index 7b524b4868d..1b7d6b7f344 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/ExceptionInterceptorMethodTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/ExceptionInterceptorMethodTest.java @@ -20,11 +20,11 @@ import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.hl7.fhir.r4.model.Patient; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import javax.servlet.http.HttpServletRequest; @@ -107,7 +107,7 @@ public class ExceptionInterceptorMethodTest { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/InjectionAttackTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/InjectionAttackTest.java index 75cdb2605f9..220ec958e59 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/InjectionAttackTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/InjectionAttackTest.java @@ -198,7 +198,7 @@ public class InjectionAttackTest { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/InterceptorThrowingExceptionR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/InterceptorThrowingExceptionR4Test.java index d47fcc36945..40bd615289f 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/InterceptorThrowingExceptionR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/InterceptorThrowingExceptionR4Test.java @@ -153,7 +153,7 @@ public class InterceptorThrowingExceptionR4Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/ResponseHighlightingInterceptorTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/ResponseHighlightingInterceptorTest.java index 1158aedfc11..2bdf4c62322 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/ResponseHighlightingInterceptorTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/ResponseHighlightingInterceptorTest.java @@ -871,7 +871,7 @@ public class ResponseHighlightingInterceptorTest { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/ServeMediaResourceRawInterceptorTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/ServeMediaResourceRawInterceptorTest.java index 6004f3b81da..152c22e0c18 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/ServeMediaResourceRawInterceptorTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/ServeMediaResourceRawInterceptorTest.java @@ -22,11 +22,11 @@ import org.eclipse.jetty.servlet.ServletHolder; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.r4.model.Media; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -137,7 +137,7 @@ public class ServeMediaResourceRawInterceptorTest { public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); ourClient.close(); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/ServerWithResponseHighlightingInterceptorExceptionTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/ServerWithResponseHighlightingInterceptorExceptionTest.java index 3b26cb754a9..4adbb0a3ad9 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/ServerWithResponseHighlightingInterceptorExceptionTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/ServerWithResponseHighlightingInterceptorExceptionTest.java @@ -69,7 +69,7 @@ public class ServerWithResponseHighlightingInterceptorExceptionTest { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/auth/AuthorizationInterceptorR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/auth/AuthorizationInterceptorR4Test.java index 4ae0084f50b..d61e71c8066 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/auth/AuthorizationInterceptorR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/auth/AuthorizationInterceptorR4Test.java @@ -66,7 +66,26 @@ import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IIdType; -import org.hl7.fhir.r4.model.*; +import org.hl7.fhir.r4.model.Bundle; +import org.hl7.fhir.r4.model.CarePlan; +import org.hl7.fhir.r4.model.CodeableConcept; +import org.hl7.fhir.r4.model.Coding; +import org.hl7.fhir.r4.model.Condition; +import org.hl7.fhir.r4.model.Consent; +import org.hl7.fhir.r4.model.Device; +import org.hl7.fhir.r4.model.DiagnosticReport; +import org.hl7.fhir.r4.model.Encounter; +import org.hl7.fhir.r4.model.IdType; +import org.hl7.fhir.r4.model.Identifier; +import org.hl7.fhir.r4.model.Observation; +import org.hl7.fhir.r4.model.OperationOutcome; +import org.hl7.fhir.r4.model.Organization; +import org.hl7.fhir.r4.model.Parameters; +import org.hl7.fhir.r4.model.Patient; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.Resource; +import org.hl7.fhir.r4.model.ResourceType; +import org.hl7.fhir.r4.model.ServiceRequest; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; @@ -4127,7 +4146,7 @@ public class AuthorizationInterceptorR4Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/auth/SearchNarrowingInterceptorTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/auth/SearchNarrowingInterceptorTest.java index ce601a2ea39..f58374a1a82 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/auth/SearchNarrowingInterceptorTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/auth/SearchNarrowingInterceptorTest.java @@ -323,7 +323,7 @@ public class SearchNarrowingInterceptorTest { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/provider/HashMapResourceProviderTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/provider/HashMapResourceProviderTest.java index c8d39971de8..975bbedc858 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/provider/HashMapResourceProviderTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/provider/HashMapResourceProviderTest.java @@ -363,7 +363,7 @@ public class HashMapResourceProviderTest { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourListenerServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/util/FhirTerserR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/util/FhirTerserR4Test.java index c48d36cf793..bef3eb87f49 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/util/FhirTerserR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/util/FhirTerserR4Test.java @@ -1457,7 +1457,7 @@ public class FhirTerserR4Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } /** diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/util/XmlUtilTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/util/XmlUtilTest.java index 07db17e6172..f6a89d0cf28 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/util/XmlUtilTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/util/XmlUtilTest.java @@ -56,7 +56,7 @@ public class XmlUtilTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/util/bundle/BundleUtilTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/util/bundle/BundleUtilTest.java index 2fe10217652..8471e47bf0d 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/util/bundle/BundleUtilTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/util/bundle/BundleUtilTest.java @@ -325,7 +325,7 @@ public class BundleUtilTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/model/IdTypeR4Test.java b/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/model/IdTypeR4Test.java index cd2104e3ac0..d397003fdfc 100644 --- a/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/model/IdTypeR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/model/IdTypeR4Test.java @@ -329,7 +329,7 @@ public class IdTypeR4Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r5/src/test/java/ca/uhn/fhir/rest/client/GenericClientTest.java b/hapi-fhir-structures-r5/src/test/java/ca/uhn/fhir/rest/client/GenericClientTest.java index 42d677208d9..1ca272afb96 100644 --- a/hapi-fhir-structures-r5/src/test/java/ca/uhn/fhir/rest/client/GenericClientTest.java +++ b/hapi-fhir-structures-r5/src/test/java/ca/uhn/fhir/rest/client/GenericClientTest.java @@ -35,14 +35,26 @@ import org.apache.http.message.BasicStatusLine; import org.hamcrest.Matchers; import org.hamcrest.core.StringContains; import org.hl7.fhir.instance.model.api.IBaseResource; -import org.hl7.fhir.r5.model.*; +import org.hl7.fhir.r5.model.Bundle; import org.hl7.fhir.r5.model.Bundle.BundleType; import org.hl7.fhir.r5.model.Bundle.HTTPVerb; -import org.junit.jupiter.api.Test; +import org.hl7.fhir.r5.model.Coding; +import org.hl7.fhir.r5.model.Encounter; +import org.hl7.fhir.r5.model.IdType; +import org.hl7.fhir.r5.model.InstantType; +import org.hl7.fhir.r5.model.MessageHeader; +import org.hl7.fhir.r5.model.Observation; +import org.hl7.fhir.r5.model.OperationOutcome; +import org.hl7.fhir.r5.model.Organization; +import org.hl7.fhir.r5.model.Parameters; +import org.hl7.fhir.r5.model.Patient; +import org.hl7.fhir.r5.model.Provenance; +import org.hl7.fhir.r5.model.StringType; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; import org.mockito.invocation.InvocationOnMock; @@ -1826,7 +1838,7 @@ public class GenericClientTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r5/src/test/java/ca/uhn/fhir/rest/server/SearchR5Test.java b/hapi-fhir-structures-r5/src/test/java/ca/uhn/fhir/rest/server/SearchR5Test.java index 4695220c324..c2dcfa910e1 100644 --- a/hapi-fhir-structures-r5/src/test/java/ca/uhn/fhir/rest/server/SearchR5Test.java +++ b/hapi-fhir-structures-r5/src/test/java/ca/uhn/fhir/rest/server/SearchR5Test.java @@ -113,7 +113,7 @@ public class SearchR5Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-structures-r5/src/test/java/ca/uhn/fhir/rest/server/ServerCapabilityStatementProviderR5Test.java b/hapi-fhir-structures-r5/src/test/java/ca/uhn/fhir/rest/server/ServerCapabilityStatementProviderR5Test.java index 9bf0eda3f7a..223434cdb10 100644 --- a/hapi-fhir-structures-r5/src/test/java/ca/uhn/fhir/rest/server/ServerCapabilityStatementProviderR5Test.java +++ b/hapi-fhir-structures-r5/src/test/java/ca/uhn/fhir/rest/server/ServerCapabilityStatementProviderR5Test.java @@ -819,7 +819,7 @@ public class ServerCapabilityStatementProviderR5Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @SuppressWarnings("unused") diff --git a/hapi-fhir-validation/src/test/java/ca/uhn/fhir/fhirpath/FluentPathTest.java b/hapi-fhir-validation/src/test/java/ca/uhn/fhir/fhirpath/FluentPathTest.java index 2102d1c049c..50488d4d338 100644 --- a/hapi-fhir-validation/src/test/java/ca/uhn/fhir/fhirpath/FluentPathTest.java +++ b/hapi-fhir-validation/src/test/java/ca/uhn/fhir/fhirpath/FluentPathTest.java @@ -74,7 +74,7 @@ public class FluentPathTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-validation/src/test/java/ca/uhn/fhir/rest/server/RequestValidatingInterceptorDstu3Test.java b/hapi-fhir-validation/src/test/java/ca/uhn/fhir/rest/server/RequestValidatingInterceptorDstu3Test.java index 81a3dae5c27..4592b3d7657 100644 --- a/hapi-fhir-validation/src/test/java/ca/uhn/fhir/rest/server/RequestValidatingInterceptorDstu3Test.java +++ b/hapi-fhir-validation/src/test/java/ca/uhn/fhir/rest/server/RequestValidatingInterceptorDstu3Test.java @@ -19,7 +19,6 @@ import ca.uhn.fhir.util.TestUtil; import ca.uhn.fhir.validation.IValidationContext; import ca.uhn.fhir.validation.IValidatorModule; import ca.uhn.fhir.validation.ResultSeverityEnum; -import com.ctc.wstx.shaded.msv_core.verifier.jaxp.DocumentBuilderFactoryImpl; import org.apache.commons.io.IOUtils; import org.apache.http.HttpResponse; import org.apache.http.client.methods.CloseableHttpResponse; @@ -46,7 +45,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mockito; -import javax.xml.parsers.DocumentBuilderFactory; import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; @@ -468,7 +466,7 @@ public class RequestValidatingInterceptorDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-validation/src/test/java/ca/uhn/fhir/rest/server/RequestValidatingInterceptorR4Test.java b/hapi-fhir-validation/src/test/java/ca/uhn/fhir/rest/server/RequestValidatingInterceptorR4Test.java index b75ccdde935..1350676b053 100644 --- a/hapi-fhir-validation/src/test/java/ca/uhn/fhir/rest/server/RequestValidatingInterceptorR4Test.java +++ b/hapi-fhir-validation/src/test/java/ca/uhn/fhir/rest/server/RequestValidatingInterceptorR4Test.java @@ -511,7 +511,7 @@ public class RequestValidatingInterceptorR4Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-validation/src/test/java/ca/uhn/fhir/rest/server/ResponseValidatingInterceptorDstu3Test.java b/hapi-fhir-validation/src/test/java/ca/uhn/fhir/rest/server/ResponseValidatingInterceptorDstu3Test.java index 8cb2d28a63b..9cf3b3ebf46 100644 --- a/hapi-fhir-validation/src/test/java/ca/uhn/fhir/rest/server/ResponseValidatingInterceptorDstu3Test.java +++ b/hapi-fhir-validation/src/test/java/ca/uhn/fhir/rest/server/ResponseValidatingInterceptorDstu3Test.java @@ -489,7 +489,7 @@ public class ResponseValidatingInterceptorDstu3Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-validation/src/test/java/ca/uhn/fhir/rest/server/ResponseValidatingInterceptorR4Test.java b/hapi-fhir-validation/src/test/java/ca/uhn/fhir/rest/server/ResponseValidatingInterceptorR4Test.java index 3242c094ce4..068baeadbd3 100644 --- a/hapi-fhir-validation/src/test/java/ca/uhn/fhir/rest/server/ResponseValidatingInterceptorR4Test.java +++ b/hapi-fhir-validation/src/test/java/ca/uhn/fhir/rest/server/ResponseValidatingInterceptorR4Test.java @@ -479,7 +479,7 @@ public class ResponseValidatingInterceptorR4Test { @AfterAll public static void afterClassClearContext() throws Exception { JettyUtil.closeServer(ourServer); - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-validation/src/test/java/ca/uhn/fhir/rest/server/ServerCapabilityStatementProviderR4Test.java b/hapi-fhir-validation/src/test/java/ca/uhn/fhir/rest/server/ServerCapabilityStatementProviderR4Test.java index daea5b0f1f7..9f9ae0dd9c4 100644 --- a/hapi-fhir-validation/src/test/java/ca/uhn/fhir/rest/server/ServerCapabilityStatementProviderR4Test.java +++ b/hapi-fhir-validation/src/test/java/ca/uhn/fhir/rest/server/ServerCapabilityStatementProviderR4Test.java @@ -131,7 +131,7 @@ public class ServerCapabilityStatementProviderR4Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeEach diff --git a/hapi-fhir-validation/src/test/java/ca/uhn/fhir/validation/ParserWithValidationDstu3Test.java b/hapi-fhir-validation/src/test/java/ca/uhn/fhir/validation/ParserWithValidationDstu3Test.java index 8064b027641..a8eb545b6f7 100644 --- a/hapi-fhir-validation/src/test/java/ca/uhn/fhir/validation/ParserWithValidationDstu3Test.java +++ b/hapi-fhir-validation/src/test/java/ca/uhn/fhir/validation/ParserWithValidationDstu3Test.java @@ -176,7 +176,7 @@ public class ParserWithValidationDstu3Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu2/hapi/validation/FhirInstanceValidatorDstu2Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu2/hapi/validation/FhirInstanceValidatorDstu2Test.java index b430632ee7b..05d5b8958e7 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu2/hapi/validation/FhirInstanceValidatorDstu2Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu2/hapi/validation/FhirInstanceValidatorDstu2Test.java @@ -260,7 +260,7 @@ public class FhirInstanceValidatorDstu2Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu2016may/hapi/validation/ResourceValidatorDstu2_1Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu2016may/hapi/validation/ResourceValidatorDstu2_1Test.java index f7830dc08a7..5bbd4054a5b 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu2016may/hapi/validation/ResourceValidatorDstu2_1Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu2016may/hapi/validation/ResourceValidatorDstu2_1Test.java @@ -41,7 +41,7 @@ public class ResourceValidatorDstu2_1Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } /** diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/DefaultProfileValidationSupportTest.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/DefaultProfileValidationSupportTest.java index a5141b3ead7..bd8b9440076 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/DefaultProfileValidationSupportTest.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/DefaultProfileValidationSupportTest.java @@ -29,7 +29,7 @@ public class DefaultProfileValidationSupportTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidatorDstu3Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidatorDstu3Test.java index ec6a6af187c..0fc1d43bfa1 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidatorDstu3Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidatorDstu3Test.java @@ -60,7 +60,6 @@ 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.junit.jupiter.api.extension.TestWatcher; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; @@ -88,8 +87,8 @@ 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.mockito.ArgumentMatchers.nullable; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.nullable; import static org.mockito.Mockito.anyString; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; @@ -1336,7 +1335,7 @@ public class FhirInstanceValidatorDstu3Test { public static void afterClassClearContext() { myDefaultValidationSupport = null; ourCtx = null; - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/QuestionnaireResponseValidatorDstu3Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/QuestionnaireResponseValidatorDstu3Test.java index d8e6061981c..1fac9165f5d 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/QuestionnaireResponseValidatorDstu3Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/QuestionnaireResponseValidatorDstu3Test.java @@ -14,15 +14,33 @@ import org.hl7.fhir.common.hapi.validation.support.CommonCodeSystemsTerminologyS import org.hl7.fhir.common.hapi.validation.support.InMemoryTerminologyServerValidationSupport; import org.hl7.fhir.common.hapi.validation.support.ValidationSupportChain; import org.hl7.fhir.common.hapi.validation.validator.FhirInstanceValidator; -import org.hl7.fhir.dstu3.model.*; +import org.hl7.fhir.dstu3.model.Attachment; +import org.hl7.fhir.dstu3.model.BooleanType; +import org.hl7.fhir.dstu3.model.CodeSystem; import org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode; +import org.hl7.fhir.dstu3.model.Coding; +import org.hl7.fhir.dstu3.model.DateTimeType; +import org.hl7.fhir.dstu3.model.DateType; +import org.hl7.fhir.dstu3.model.DecimalType; +import org.hl7.fhir.dstu3.model.IdType; +import org.hl7.fhir.dstu3.model.IntegerType; +import org.hl7.fhir.dstu3.model.MarkdownType; +import org.hl7.fhir.dstu3.model.Quantity; +import org.hl7.fhir.dstu3.model.Questionnaire; import org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent; import org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent; import org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent; import org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType; +import org.hl7.fhir.dstu3.model.QuestionnaireResponse; import org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent; import org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent; import org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus; +import org.hl7.fhir.dstu3.model.Reference; +import org.hl7.fhir.dstu3.model.StringType; +import org.hl7.fhir.dstu3.model.TimeType; +import org.hl7.fhir.dstu3.model.Type; +import org.hl7.fhir.dstu3.model.UriType; +import org.hl7.fhir.dstu3.model.ValueSet; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.utilities.validation.ValidationMessage; import org.junit.jupiter.api.AfterAll; @@ -1187,7 +1205,7 @@ public class QuestionnaireResponseValidatorDstu3Test { public static void afterClassClearContext() { myDefaultValidationSupport.flush(); myDefaultValidationSupport = null; - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/QuestionnaireValidatorDstu3Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/QuestionnaireValidatorDstu3Test.java index 156cafed9a1..0bdd566968b 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/QuestionnaireValidatorDstu3Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/QuestionnaireValidatorDstu3Test.java @@ -154,6 +154,6 @@ public class QuestionnaireValidatorDstu3Test { public static void afterClassClearContext() { myDefaultValidationSupport.flush(); myDefaultValidationSupport = null; - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/ResourceValidatorDstu3Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/ResourceValidatorDstu3Test.java index 54f643cb14b..951e2899e5a 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/ResourceValidatorDstu3Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/ResourceValidatorDstu3Test.java @@ -481,7 +481,7 @@ public class ResourceValidatorDstu3Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @ResourceDef(name = "Patient") diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/SchemaValidationDstu3Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/SchemaValidationDstu3Test.java index dcc4b7287f4..7290cb9b3cb 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/SchemaValidationDstu3Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/SchemaValidationDstu3Test.java @@ -60,6 +60,6 @@ public class SchemaValidationDstu3Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/SchematronValidationDstu3QuestionnaireTest.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/SchematronValidationDstu3QuestionnaireTest.java index 228ac642bb1..dfe95cf4a69 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/SchematronValidationDstu3QuestionnaireTest.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/SchematronValidationDstu3QuestionnaireTest.java @@ -120,6 +120,6 @@ public class SchematronValidationDstu3QuestionnaireTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/utils/FhirPathEngineTest.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/utils/FhirPathEngineTest.java index 974eeee237f..402ba30c6df 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/utils/FhirPathEngineTest.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/utils/FhirPathEngineTest.java @@ -76,7 +76,7 @@ public class FhirPathEngineTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/utils/FhirPathEngineR4Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/utils/FhirPathEngineR4Test.java index 89bc5565ba3..45a6ac9fe0f 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/utils/FhirPathEngineR4Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/utils/FhirPathEngineR4Test.java @@ -7,7 +7,19 @@ import ca.uhn.fhir.util.TestUtil; import org.hl7.fhir.dstu3.utils.FhirPathEngineTest; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.r4.hapi.ctx.HapiWorkerContext; -import org.hl7.fhir.r4.model.*; +import org.hl7.fhir.r4.model.Base; +import org.hl7.fhir.r4.model.BooleanType; +import org.hl7.fhir.r4.model.CodeableConcept; +import org.hl7.fhir.r4.model.Coding; +import org.hl7.fhir.r4.model.DateTimeType; +import org.hl7.fhir.r4.model.Observation; +import org.hl7.fhir.r4.model.Patient; +import org.hl7.fhir.r4.model.Quantity; +import org.hl7.fhir.r4.model.QuestionnaireResponse; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.Specimen; +import org.hl7.fhir.r4.model.StringType; +import org.hl7.fhir.r4.model.StructureDefinition; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -161,7 +173,7 @@ public class FhirPathEngineR4Test { @AfterAll public static void afterClassClearContext() throws Exception { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } @BeforeAll diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java index c235ee20fe8..1443ec98225 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java @@ -1498,7 +1498,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest { public static void afterClassClearContext() { myDefaultValidationSupport.flush(); myDefaultValidationSupport = null; - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/QuestionnaireResponseValidatorR4Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/QuestionnaireResponseValidatorR4Test.java index 5054705baca..a231c154a24 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/QuestionnaireResponseValidatorR4Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/QuestionnaireResponseValidatorR4Test.java @@ -818,7 +818,7 @@ public class QuestionnaireResponseValidatorR4Test { public static void afterClassClearContext() { myDefaultValidationSupport.flush(); myDefaultValidationSupport = null; - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/QuestionnaireValidatorR4Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/QuestionnaireValidatorR4Test.java index 91d3c23f3af..1453e19f61e 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/QuestionnaireValidatorR4Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/QuestionnaireValidatorR4Test.java @@ -144,6 +144,6 @@ public class QuestionnaireValidatorR4Test { public static void afterClassClearContext() { myDefaultValidationSupport.flush(); myDefaultValidationSupport = null; - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/SchemaValidationR4Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/SchemaValidationR4Test.java index 1d870ed32ac..8744d000d34 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/SchemaValidationR4Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/SchemaValidationR4Test.java @@ -5,7 +5,6 @@ import ca.uhn.fhir.util.TestUtil; import ca.uhn.fhir.validation.FhirValidator; import ca.uhn.fhir.validation.ValidationResult; import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.slf4j.Logger; @@ -93,6 +92,6 @@ public class SchemaValidationR4Test { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/SchematronValidationR4QuestionnaireTest.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/SchematronValidationR4QuestionnaireTest.java index 5007046a919..1e22af13866 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/SchematronValidationR4QuestionnaireTest.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/SchematronValidationR4QuestionnaireTest.java @@ -125,6 +125,6 @@ public class SchematronValidationR4QuestionnaireTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } } diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r5/validation/FhirInstanceValidatorR5Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r5/validation/FhirInstanceValidatorR5Test.java index 607f1e136e7..f771bca1490 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r5/validation/FhirInstanceValidatorR5Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r5/validation/FhirInstanceValidatorR5Test.java @@ -21,7 +21,26 @@ import org.hl7.fhir.common.hapi.validation.support.InMemoryTerminologyServerVali import org.hl7.fhir.common.hapi.validation.support.ValidationSupportChain; import org.hl7.fhir.common.hapi.validation.validator.FhirInstanceValidator; import org.hl7.fhir.instance.model.api.IBaseResource; -import org.hl7.fhir.r5.model.*; +import org.hl7.fhir.r5.model.Base64BinaryType; +import org.hl7.fhir.r5.model.CodeSystem; +import org.hl7.fhir.r5.model.CodeType; +import org.hl7.fhir.r5.model.ContactPoint; +import org.hl7.fhir.r5.model.DateTimeType; +import org.hl7.fhir.r5.model.DocumentReference; +import org.hl7.fhir.r5.model.Enumerations; +import org.hl7.fhir.r5.model.Extension; +import org.hl7.fhir.r5.model.Narrative; +import org.hl7.fhir.r5.model.Observation; +import org.hl7.fhir.r5.model.Patient; +import org.hl7.fhir.r5.model.Period; +import org.hl7.fhir.r5.model.Practitioner; +import org.hl7.fhir.r5.model.Procedure; +import org.hl7.fhir.r5.model.QuestionnaireResponse; +import org.hl7.fhir.r5.model.Reference; +import org.hl7.fhir.r5.model.RelatedPerson; +import org.hl7.fhir.r5.model.StringType; +import org.hl7.fhir.r5.model.StructureDefinition; +import org.hl7.fhir.r5.model.ValueSet; import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent; import org.hl7.fhir.r5.terminologies.ValueSetExpander; import org.hl7.fhir.r5.utils.IResourceValidator; @@ -1007,7 +1026,7 @@ public class FhirInstanceValidatorR5Test { public static void afterClassClearContext() { myDefaultValidationSupport.flush(); myDefaultValidationSupport = null; - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r5/validation/QuestionnaireResponseValidatorR5Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r5/validation/QuestionnaireResponseValidatorR5Test.java index cd64ab30f22..5a3e222bdb5 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r5/validation/QuestionnaireResponseValidatorR5Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r5/validation/QuestionnaireResponseValidatorR5Test.java @@ -715,7 +715,7 @@ public class QuestionnaireResponseValidatorR5Test { public static void afterClassClearContext() { myDefaultValidationSupport.flush(); myDefaultValidationSupport = null; - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); } diff --git a/tests/hapi-fhir-base-test-jaxrsserver-kotlin/src/test/kotlin/ca/uhn/fhir/jaxrs/server/example/ExtendedOrganizationResourceTest.kt b/tests/hapi-fhir-base-test-jaxrsserver-kotlin/src/test/kotlin/ca/uhn/fhir/jaxrs/server/example/ExtendedOrganizationResourceTest.kt index 48d87593314..0d13c2ff978 100644 --- a/tests/hapi-fhir-base-test-jaxrsserver-kotlin/src/test/kotlin/ca/uhn/fhir/jaxrs/server/example/ExtendedOrganizationResourceTest.kt +++ b/tests/hapi-fhir-base-test-jaxrsserver-kotlin/src/test/kotlin/ca/uhn/fhir/jaxrs/server/example/ExtendedOrganizationResourceTest.kt @@ -40,7 +40,7 @@ class ExtendedOrganizationResourceTest { @Throws(Exception::class) fun afterClassClearContext() { JettyUtil.closeServer(jettyServer) - TestUtil.clearAllStaticFieldsForUnitTest() + TestUtil.randomizeLocaleAndTimezone() } @JvmStatic diff --git a/tests/hapi-fhir-base-test-mindeps-server/src/test/java/ca/uhn/fhir/parser/MultiVersionXmlParserTest.java b/tests/hapi-fhir-base-test-mindeps-server/src/test/java/ca/uhn/fhir/parser/MultiVersionXmlParserTest.java index beee81ad933..1573753c9d1 100644 --- a/tests/hapi-fhir-base-test-mindeps-server/src/test/java/ca/uhn/fhir/parser/MultiVersionXmlParserTest.java +++ b/tests/hapi-fhir-base-test-mindeps-server/src/test/java/ca/uhn/fhir/parser/MultiVersionXmlParserTest.java @@ -72,7 +72,7 @@ public class MultiVersionXmlParserTest { @AfterAll public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); + TestUtil.randomizeLocaleAndTimezone(); }