Fix tests
This commit is contained in:
parent
a9b29d5088
commit
7dbd5a21ca
|
@ -12,7 +12,7 @@ import ca.uhn.fhir.rest.gclient.ITransactionTyped;
|
|||
|
||||
public class ClientTest {
|
||||
|
||||
private static final FhirContext ctx = FhirContext.forDstu1();
|
||||
private static FhirContext ctx = FhirContext.forDstu1();
|
||||
|
||||
@Test
|
||||
public void testTransaction() {
|
||||
|
|
|
@ -5,6 +5,7 @@ import static org.junit.Assert.assertThat;
|
|||
import static org.junit.Assert.fail;
|
||||
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
|
@ -12,14 +13,20 @@ import ca.uhn.fhir.model.dstu.composite.QuantityDt;
|
|||
import ca.uhn.fhir.model.dstu.resource.Organization;
|
||||
import ca.uhn.fhir.model.dstu.resource.Patient;
|
||||
import ca.uhn.fhir.model.dstu.valueset.QuantityCompararatorEnum;
|
||||
import ca.uhn.fhir.util.TestUtil;
|
||||
|
||||
public class MultiVersionXmlParserTest {
|
||||
|
||||
private static final FhirContext ourCtxDstu1 = FhirContext.forDstu1();
|
||||
private static final FhirContext ourCtxDstu2 = FhirContext.forDstu2();
|
||||
private static FhirContext ourCtxDstu1 = FhirContext.forDstu1();
|
||||
private static FhirContext ourCtxDstu2 = FhirContext.forDstu2();
|
||||
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(MultiVersionXmlParserTest.class);
|
||||
|
||||
@AfterClass
|
||||
public static void afterClassClearContext() {
|
||||
TestUtil.clearAllStaticFieldsForUnitTest();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEncodeExtensionFromDifferentVersion() {
|
||||
Patient p = new Patient();
|
||||
|
|
|
@ -34,11 +34,11 @@ import ca.uhn.fhir.rest.server.exceptions.MethodNotAllowedException;
|
|||
* other than those supported by the server with an HTTP 405. This is a requirement
|
||||
* of some security assessments.
|
||||
*/
|
||||
public class BanUnsupprtedHttpMethodsInterceptor extends InterceptorAdapter {
|
||||
public class BanUnsupportedHttpMethodsInterceptor extends InterceptorAdapter {
|
||||
|
||||
private Set<RequestTypeEnum> myAllowedMethods = new HashSet<RequestTypeEnum>();
|
||||
|
||||
public BanUnsupprtedHttpMethodsInterceptor() {
|
||||
public BanUnsupportedHttpMethodsInterceptor() {
|
||||
myAllowedMethods.add(RequestTypeEnum.GET);
|
||||
myAllowedMethods.add(RequestTypeEnum.OPTIONS);
|
||||
myAllowedMethods.add(RequestTypeEnum.DELETE);
|
|
@ -64,6 +64,7 @@ import ca.uhn.fhir.rest.param.StringAndListParam;
|
|||
import ca.uhn.fhir.rest.param.StringParam;
|
||||
import ca.uhn.fhir.rest.server.EncodingEnum;
|
||||
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
|
||||
import ca.uhn.fhir.util.TestUtil;
|
||||
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
public class AbstractJaxRsResourceProviderDstu3Test {
|
||||
|
@ -72,7 +73,7 @@ public class AbstractJaxRsResourceProviderDstu3Test {
|
|||
private static IGenericClient client;
|
||||
|
||||
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu3();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu3();
|
||||
private static final String PATIENT_NAME = "Van Houte";
|
||||
|
||||
private static int ourPort;
|
||||
|
@ -87,6 +88,11 @@ public class AbstractJaxRsResourceProviderDstu3Test {
|
|||
assertEquals(id, Integer.parseInt(resource.getIdElement().getIdPart()));
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void afterClassClearContext() {
|
||||
TestUtil.clearAllStaticFieldsForUnitTest();
|
||||
}
|
||||
|
||||
private void compareResultUrl(String url, IBaseResource resource) {
|
||||
assertEquals(url, resource.getIdElement().getValueAsString().substring(serverBase.length() - 1));
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ import ca.uhn.fhir.rest.param.StringAndListParam;
|
|||
import ca.uhn.fhir.rest.param.StringParam;
|
||||
import ca.uhn.fhir.rest.server.EncodingEnum;
|
||||
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
|
||||
import ca.uhn.fhir.util.TestUtil;
|
||||
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
public class AbstractJaxRsResourceProviderTest {
|
||||
|
@ -72,7 +73,7 @@ public class AbstractJaxRsResourceProviderTest {
|
|||
private static IGenericClient client;
|
||||
|
||||
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu2();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu2();
|
||||
private static final String PATIENT_NAME = "Van Houte";
|
||||
|
||||
private static int ourPort;
|
||||
|
@ -91,6 +92,11 @@ public class AbstractJaxRsResourceProviderTest {
|
|||
assertEquals(url, resource.getId().getValueAsString().substring(serverBase.length() - 1));
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void afterClassClearContext() {
|
||||
TestUtil.clearAllStaticFieldsForUnitTest();
|
||||
}
|
||||
|
||||
private Patient createPatient(long id) {
|
||||
Patient theResource = new Patient();
|
||||
theResource.setId(new IdDt(id));
|
||||
|
|
|
@ -42,11 +42,16 @@ import ca.uhn.fhir.rest.server.EncodingEnum;
|
|||
public class JaxRsPatientProviderDstu3Test {
|
||||
|
||||
private static IGenericClient client;
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu3();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu3();
|
||||
private static final String PATIENT_NAME = "Van Houte";
|
||||
private static int ourPort;
|
||||
private static Server jettyServer;
|
||||
|
||||
@AfterClass
|
||||
public static void afterClassClearContext() {
|
||||
TestUtil.clearAllStaticFieldsForUnitTest();
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass()
|
||||
throws Exception {
|
||||
|
|
|
@ -41,11 +41,16 @@ import ca.uhn.fhir.rest.server.EncodingEnum;
|
|||
public class JaxRsPatientProviderTest {
|
||||
|
||||
private static IGenericClient client;
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu2();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu2();
|
||||
private static final String PATIENT_NAME = "Van Houte";
|
||||
private static int ourPort;
|
||||
private static Server jettyServer;
|
||||
|
||||
@AfterClass
|
||||
public static void afterClassClearContext() {
|
||||
TestUtil.clearAllStaticFieldsForUnitTest();
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass()
|
||||
throws Exception {
|
||||
|
|
|
@ -19,7 +19,7 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
|
||||
public class SearchParamExtractorDstu3Test {
|
||||
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu3();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu3();
|
||||
private static IValidationSupport ourValidationSupport;
|
||||
|
||||
@AfterClass
|
||||
|
|
|
@ -21,7 +21,7 @@ import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor;
|
|||
public class ExampleServerIT {
|
||||
|
||||
private static IGenericClient ourClient;
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu2();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu2();
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ExampleServerIT.class);
|
||||
|
||||
private static int ourPort;
|
||||
|
|
|
@ -32,7 +32,7 @@ import ca.uhn.fhir.rest.server.FifoMemoryPagingProvider;
|
|||
import ca.uhn.fhir.rest.server.HardcodedServerAddressStrategy;
|
||||
import ca.uhn.fhir.rest.server.IResourceProvider;
|
||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||
import ca.uhn.fhir.rest.server.interceptor.BanUnsupprtedHttpMethodsInterceptor;
|
||||
import ca.uhn.fhir.rest.server.interceptor.BanUnsupportedHttpMethodsInterceptor;
|
||||
import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor;
|
||||
import ca.uhn.fhir.rest.server.interceptor.ResponseHighlighterInterceptor;
|
||||
import ca.uhn.fhirtest.config.TestDstu3Config;
|
||||
|
@ -176,7 +176,7 @@ public class TestRestfulServer extends RestfulServer {
|
|||
* makes things a little easier for testers.
|
||||
*/
|
||||
registerInterceptor(new ResponseHighlighterInterceptor());
|
||||
registerInterceptor(new BanUnsupprtedHttpMethodsInterceptor());
|
||||
registerInterceptor(new BanUnsupportedHttpMethodsInterceptor());
|
||||
|
||||
/*
|
||||
* Default to JSON with pretty printing
|
||||
|
|
|
@ -15,7 +15,7 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
|
||||
public class BaseParserTest {
|
||||
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu1();
|
||||
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BaseParserTest.class);
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ import ch.qos.logback.core.Appender;
|
|||
*/
|
||||
public class LoggingInterceptorTest {
|
||||
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static int ourPort;
|
||||
private static Server ourServer;
|
||||
private Logger myLoggerRoot;
|
||||
|
|
|
@ -41,7 +41,7 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
public class CompositeParameterTest {
|
||||
|
||||
private static CloseableHttpClient ourClient;
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static int ourPort;
|
||||
private static Server ourServer;
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
public class CompressionTest {
|
||||
|
||||
private static CloseableHttpClient ourClient;
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(CompressionTest.class);
|
||||
private static int ourPort;
|
||||
private static Server ourServer;
|
||||
|
|
|
@ -40,7 +40,7 @@ public class CorsTest {
|
|||
private static CloseableHttpClient ourClient;
|
||||
private static Server ourServer;
|
||||
private static String ourBaseUri;
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(CorsTest.class);
|
||||
|
||||
@Test
|
||||
|
|
|
@ -49,7 +49,7 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
|
||||
public class CreateTest {
|
||||
private static CloseableHttpClient ourClient;
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static EncodingEnum ourLastEncoding;
|
||||
private static String ourLastResourceBody;
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(CreateTest.class);
|
||||
|
|
|
@ -40,7 +40,7 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
public class DefaultEncodingTest {
|
||||
|
||||
private static CloseableHttpClient ourClient;
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static int ourPort;
|
||||
private static RestfulServer ourRestfulServer;
|
||||
private static Server ourServer;
|
||||
|
|
|
@ -27,7 +27,7 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class DestroyTest {
|
||||
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu1();
|
||||
|
||||
@Test
|
||||
public void testDestroyCallsAnnotatedMethodsOnProviders() throws ServletException {
|
||||
|
|
|
@ -51,7 +51,7 @@ public class ExceptionTest {
|
|||
|
||||
private static final String OPERATION_OUTCOME_DETAILS = "OperationOutcomeDetails";
|
||||
private static CloseableHttpClient ourClient;
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static Class<? extends Exception> ourExceptionType;
|
||||
private static boolean ourGenerateOperationOutcome;
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ExceptionTest.class);
|
||||
|
|
|
@ -49,7 +49,7 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
public class InterceptorTest {
|
||||
|
||||
private static CloseableHttpClient ourClient;
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static int ourPort;
|
||||
private static Server ourServer;
|
||||
private static RestfulServer servlet;
|
||||
|
|
|
@ -49,7 +49,7 @@ public class PagingTest {
|
|||
private static SimpleBundleProvider ourBundleProvider;
|
||||
private static CloseableHttpClient ourClient;
|
||||
private static FhirContext ourContext;
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static int ourPort;
|
||||
private static Server ourServer;
|
||||
private IPagingProvider myPagingProvider;
|
||||
|
|
|
@ -50,7 +50,7 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
|
||||
public class PlainProviderTest {
|
||||
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(PlainProviderTest.class);
|
||||
private CloseableHttpClient myClient;
|
||||
private int myPort;
|
||||
|
|
|
@ -36,7 +36,7 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
public class ReadDstu1Test {
|
||||
|
||||
private static CloseableHttpClient ourClient;
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ReadDstu1Test.class);
|
||||
private static int ourPort;
|
||||
private static Server ourServer;
|
||||
|
|
|
@ -54,7 +54,7 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
public class ReferenceParameterTest {
|
||||
|
||||
private static CloseableHttpClient ourClient;
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static ReferenceParam ourLastRefParam;
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ReferenceParameterTest.class);
|
||||
private static int ourPort;
|
||||
|
|
|
@ -24,7 +24,7 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
public class ResourceProviderWithNoMethodsTest {
|
||||
|
||||
private Server ourServer;
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu1();
|
||||
|
||||
@After
|
||||
public void after() throws Exception {
|
||||
|
|
|
@ -88,7 +88,7 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
|
||||
public class RestfulServerMethodTest {
|
||||
private static CloseableHttpClient ourClient;
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RestfulServerMethodTest.class);
|
||||
private static int ourPort;
|
||||
private static DummyDiagnosticReportResourceProvider ourReportProvider;
|
||||
|
|
|
@ -51,7 +51,7 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
public class ServerFeaturesTest {
|
||||
|
||||
private static CloseableHttpClient ourClient;
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static int ourPort;
|
||||
private static Server ourServer;
|
||||
private static RestfulServer servlet;
|
||||
|
|
|
@ -31,7 +31,7 @@ import ca.uhn.fhir.rest.param.StringParam;
|
|||
import ca.uhn.fhir.util.TestUtil;
|
||||
|
||||
public class ServerInvalidDefinitionTest {
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu1();
|
||||
|
||||
/**
|
||||
* Normal, should initialize properly
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.util.List;
|
|||
* Created by Bill de Beaubien on 11/1/2014.
|
||||
*/
|
||||
public class ServerProvidedResourceScannerTest extends TestCase {
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu1();
|
||||
|
||||
@Test
|
||||
public void testWhenRestfulServerInitialized_annotatedResources_shouldBeAddedToContext() throws ServletException {
|
||||
|
|
|
@ -62,7 +62,7 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
public class AuditingInterceptorTest {
|
||||
|
||||
private static CloseableHttpClient ourClient;
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static int ourPort;
|
||||
private static Server ourServer;
|
||||
private static RestfulServer servlet;
|
||||
|
|
|
@ -48,7 +48,7 @@ public class ExceptionHandlingInterceptorTest {
|
|||
private static ExceptionHandlingInterceptor myInterceptor;
|
||||
private static final String OPERATION_OUTCOME_DETAILS = "OperationOutcomeDetails";
|
||||
private static CloseableHttpClient ourClient;
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static Class<? extends Exception> ourExceptionType;
|
||||
private static boolean ourGenerateOperationOutcome;
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ExceptionTest.class);
|
||||
|
|
|
@ -41,7 +41,7 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
public class ExceptionInterceptorMethodTest {
|
||||
|
||||
private static CloseableHttpClient ourClient;
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu1();
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ExceptionInterceptorMethodTest.class);
|
||||
private static int ourPort;
|
||||
private static Server ourServer;
|
||||
|
|
|
@ -26,7 +26,7 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
|
||||
public class ModelSerializationDstu2Test {
|
||||
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu2();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu2();
|
||||
|
||||
@AfterClass
|
||||
public static void afterClassClearContext() {
|
||||
|
|
|
@ -35,7 +35,7 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
|
||||
public class CustomTypeDstu2Test {
|
||||
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu2();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu2();
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(CustomTypeDstu2Test.class);
|
||||
|
||||
@AfterClass
|
||||
|
|
|
@ -16,7 +16,7 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
|
||||
public class ExtensionsDstu2Test {
|
||||
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu2();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu2();
|
||||
|
||||
@AfterClass
|
||||
public static void afterClassClearContext() {
|
||||
|
|
|
@ -78,7 +78,7 @@ import net.sf.json.JSONSerializer;
|
|||
import net.sf.json.JsonConfig;
|
||||
|
||||
public class JsonParserDstu2Test {
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu2();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu2();
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(JsonParserDstu2Test.class);
|
||||
|
||||
@Test
|
||||
|
|
|
@ -103,7 +103,7 @@ import ca.uhn.fhir.rest.server.Constants;
|
|||
import ca.uhn.fhir.util.TestUtil;
|
||||
|
||||
public class XmlParserDstu2Test {
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu2();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu2();
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(XmlParserDstu2Test.class);
|
||||
|
||||
@Test
|
||||
|
|
|
@ -31,7 +31,7 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
|
||||
public class DeleteDstu2Test {
|
||||
private static CloseableHttpClient ourClient;
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu2();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu2();
|
||||
private static boolean ourInvoked;
|
||||
private static String ourLastConditionalUrl;
|
||||
private static IdDt ourLastIdParam;
|
||||
|
|
|
@ -59,7 +59,7 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
public class InterceptorUserDataMapDstu2Test {
|
||||
|
||||
private static CloseableHttpClient ourClient;
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu2();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu2();
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(InterceptorUserDataMapDstu2Test.class);
|
||||
private static int ourPort;
|
||||
private static Server ourServer;
|
||||
|
|
|
@ -65,7 +65,7 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
public class LoggingInterceptorDstu2Test {
|
||||
|
||||
private static CloseableHttpClient ourClient;
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu2();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu2();
|
||||
private static int ourPort;
|
||||
private static Server ourServer;
|
||||
private static RestfulServer servlet;
|
||||
|
|
|
@ -74,7 +74,7 @@ import ca.uhn.fhir.util.UrlUtil;
|
|||
public class ResponseHighlightingInterceptorTest {
|
||||
|
||||
private static CloseableHttpClient ourClient;
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu2();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu2();
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ResponseHighlightingInterceptorTest.class);
|
||||
private static int ourPort;
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
public class ServerActionInterceptorTest {
|
||||
|
||||
private static CloseableHttpClient ourClient;
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu2();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu2();
|
||||
private static int ourPort;
|
||||
private static Server ourServer;
|
||||
private static IServerInterceptor ourInterceptor;
|
||||
|
|
|
@ -20,7 +20,7 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
public class MinimizeResources {
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(MinimizeResources.class);
|
||||
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu3();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu3();
|
||||
|
||||
@AfterClass
|
||||
public static void afterClassClearContext() {
|
||||
|
|
|
@ -21,7 +21,7 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
|
||||
public class ModelSerializationDstu3Test {
|
||||
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu3();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu3();
|
||||
|
||||
/**
|
||||
* Verify that MaritalStatusCodeEnum (and, by extension, BoundCodeableConcepts in general) are serializable. Author: Nick Peterson (nrpeterson@gmail.com)
|
||||
|
|
|
@ -36,7 +36,7 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
|
||||
public class CustomTypeDstu3Test {
|
||||
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu3();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu3();
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(CustomTypeDstu3Test.class);
|
||||
|
||||
@Before
|
||||
|
|
|
@ -36,7 +36,7 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
public class DateRangeParamSearchDstu3Test {
|
||||
|
||||
private static CloseableHttpClient ourClient;
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu3();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu3();
|
||||
private static DateRangeParam ourLastDateRange;
|
||||
private static int ourPort;
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
public class InterceptorDstu3Test {
|
||||
|
||||
private static CloseableHttpClient ourClient;
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu3();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu3();
|
||||
private static int ourPort;
|
||||
private static Server ourServer;
|
||||
private static RestfulServer ourServlet;
|
||||
|
|
|
@ -40,11 +40,12 @@ import ca.uhn.fhir.util.VersionUtil;
|
|||
public class MetadataDstu3Test {
|
||||
|
||||
private static CloseableHttpClient ourClient;
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu3();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu3();
|
||||
private static int ourPort;
|
||||
private static Server ourServer;
|
||||
private static RestfulServer servlet;
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(MetadataDstu3Test.class);
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(MetadataDstu3Test.class);
|
||||
|
||||
@Test
|
||||
public void testSummary() throws Exception {
|
||||
String output;
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
package ca.uhn.fhir.rest.server.interceptor;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -24,14 +19,11 @@ 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.core.StringContains;
|
||||
import org.hl7.fhir.dstu3.model.IdType;
|
||||
import org.hl7.fhir.dstu3.model.Patient;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.rest.annotation.IdParam;
|
||||
|
@ -45,7 +37,7 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
public class BanUnsupprtedHttpMethodsInterceptorDstu3Test {
|
||||
|
||||
private static CloseableHttpClient ourClient;
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu3();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu3();
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BanUnsupprtedHttpMethodsInterceptorDstu3Test.class);
|
||||
private static int ourPort;
|
||||
private static Server ourServer;
|
||||
|
@ -127,7 +119,7 @@ public class BanUnsupprtedHttpMethodsInterceptorDstu3Test {
|
|||
servlet = new RestfulServer(ourCtx);
|
||||
|
||||
servlet.setResourceProviders(new DummyPatientResourceProvider());
|
||||
servlet.registerInterceptor(new BanUnsupprtedHttpMethodsInterceptor());
|
||||
servlet.registerInterceptor(new BanUnsupportedHttpMethodsInterceptor());
|
||||
|
||||
ServletHolder servletHolder = new ServletHolder(servlet);
|
||||
proxyHandler.addServletWithMapping(servletHolder, "/*");
|
||||
|
|
|
@ -50,7 +50,7 @@ import ca.uhn.fhir.util.TestUtil;
|
|||
public class QuestionnaireResponseValidatorDstu3Test {
|
||||
private static DefaultProfileValidationSupport myDefaultValidationSupport = new DefaultProfileValidationSupport();
|
||||
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu3();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu3();
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(QuestionnaireResponseValidatorDstu3Test.class);
|
||||
|
||||
private FhirInstanceValidator myInstanceVal;
|
||||
|
|
|
@ -10,7 +10,6 @@ import static org.junit.Assert.assertNotNull;
|
|||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
|
@ -61,6 +60,7 @@ import org.hl7.fhir.instance.model.api.INarrative;
|
|||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||
import org.hl7.fhir.instance.utilities.xhtml.XhtmlNode;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.xml.sax.SAXException;
|
||||
|
@ -71,11 +71,12 @@ import ca.uhn.fhir.model.api.annotation.Child;
|
|||
import ca.uhn.fhir.model.api.annotation.ResourceDef;
|
||||
import ca.uhn.fhir.narrative.INarrativeGenerator;
|
||||
import ca.uhn.fhir.rest.server.Constants;
|
||||
import ca.uhn.fhir.util.TestUtil;
|
||||
import net.sf.json.JSON;
|
||||
import net.sf.json.JSONSerializer;
|
||||
|
||||
public class JsonParserHl7OrgDstu2Test {
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu2Hl7Org();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu2Hl7Org();
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(JsonParserHl7OrgDstu2Test.class);
|
||||
|
||||
@After
|
||||
|
@ -83,6 +84,11 @@ public class JsonParserHl7OrgDstu2Test {
|
|||
ourCtx.setNarrativeGenerator(null);
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void afterClassClearContext() {
|
||||
TestUtil.clearAllStaticFieldsForUnitTest();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEncodeUndeclaredExtensionWithEnumerationContent() {
|
||||
IParser parser = ourCtx.newJsonParser();
|
||||
|
|
|
@ -35,7 +35,7 @@ public class DeleteConditionalHl7OrgTest {
|
|||
private static CloseableHttpClient ourClient;
|
||||
private static String ourLastConditionalUrl;
|
||||
private static int ourPort;
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu2Hl7Org();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu2Hl7Org();
|
||||
private static Server ourServer;
|
||||
private static IdType ourLastIdParam;
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@ package ca.uhn.fhir.validation;
|
|||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
|
@ -25,6 +23,7 @@ import org.hl7.fhir.instance.model.Reference;
|
|||
import org.hl7.fhir.instance.model.StringType;
|
||||
import org.hl7.fhir.instance.model.ValueSet;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
@ -33,16 +32,19 @@ import org.mockito.stubbing.Answer;
|
|||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
|
||||
import ca.uhn.fhir.util.TestUtil;
|
||||
|
||||
public class QuestionnaireResponseValidatorIntegrationTest {
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu2Hl7Org();
|
||||
|
||||
private static FhirContext ourCtx = FhirContext.forDstu2Hl7Org();
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(QuestionnaireResponseValidatorIntegrationTest.class);
|
||||
|
||||
private IResourceLoader myResourceLoaderMock;
|
||||
|
||||
private FhirValidator myVal;
|
||||
|
||||
@AfterClass
|
||||
public static void afterClassClearContext() {
|
||||
TestUtil.clearAllStaticFieldsForUnitTest();
|
||||
}
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
myResourceLoaderMock = mock(IResourceLoader.class);
|
||||
|
|
|
@ -23,13 +23,15 @@ import org.hl7.fhir.instance.model.ValueSet;
|
|||
import org.hl7.fhir.instance.utils.WorkerContext;
|
||||
import org.hl7.fhir.instance.validation.QuestionnaireResponseValidator;
|
||||
import org.hl7.fhir.instance.validation.ValidationMessage;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.util.TestUtil;
|
||||
|
||||
public class QuestionnaireResponseValidatorTest {
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu2Hl7Org();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu2Hl7Org();
|
||||
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(QuestionnaireResponseValidatorTest.class);
|
||||
private QuestionnaireResponseValidator myVal;
|
||||
|
@ -42,6 +44,11 @@ public class QuestionnaireResponseValidatorTest {
|
|||
myVal = new QuestionnaireResponseValidator(myWorkerCtx);
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void afterClassClearContext() {
|
||||
TestUtil.clearAllStaticFieldsForUnitTest();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAnswerWithWrongType() {
|
||||
Questionnaire q = new Questionnaire();
|
||||
|
|
Loading…
Reference in New Issue