From 75a68a0332e4574dc418ade83926de13ccdf15c2 Mon Sep 17 00:00:00 2001 From: James Agnew Date: Thu, 26 Jul 2018 18:58:23 +0700 Subject: [PATCH] Unit test fix --- .../UnprocessableEntityException.java | 31 +++++++++++-------- .../r4/FhirResourceDaoSearchParameterR4.java | 2 +- .../java/org/hl7/fhir/r4/hapi/ctx/FhirR4.java | 2 +- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/exceptions/UnprocessableEntityException.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/exceptions/UnprocessableEntityException.java index e59932639fe..2274a94e27a 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/exceptions/UnprocessableEntityException.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/exceptions/UnprocessableEntityException.java @@ -9,9 +9,9 @@ package ca.uhn.fhir.rest.server.exceptions; * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,44 +20,42 @@ package ca.uhn.fhir.rest.server.exceptions; * #L% */ -import org.hl7.fhir.instance.model.api.IBaseOperationOutcome; - import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.util.CoverageIgnore; import ca.uhn.fhir.util.OperationOutcomeUtil; +import org.hl7.fhir.instance.model.api.IBaseOperationOutcome; /** * Represents an HTTP 422 Unprocessable Entity response, which means that a resource was rejected by the server because it "violated applicable FHIR profiles or server business rules". - * + * *

* This exception will generally contain an {@link IBaseOperationOutcome} instance which details the failure. *

- * + * * @see InvalidRequestException Which corresponds to an HTTP 400 Bad Request failure */ @CoverageIgnore public class UnprocessableEntityException extends BaseServerResponseException { + public static final int STATUS_CODE = Constants.STATUS_HTTP_422_UNPROCESSABLE_ENTITY; private static final String DEFAULT_MESSAGE = "Unprocessable Entity"; private static final long serialVersionUID = 1L; - public static final int STATUS_CODE = Constants.STATUS_HTTP_422_UNPROCESSABLE_ENTITY; /** * Constructor - * - * @param theMessage - * The message to add to the status line - * @param theOperationOutcome The {@link IBaseOperationOutcome} resource to return to the client + * + * @param theMessage The message to add to the status line + * @param theOperationOutcome The {@link IBaseOperationOutcome} resource to return to the client */ public UnprocessableEntityException(String theMessage, IBaseOperationOutcome theOperationOutcome) { super(STATUS_CODE, theMessage, theOperationOutcome); } - + /** * Constructor which accepts an {@link IBaseOperationOutcome} resource which will be supplied in the response - * + * * @deprecated Use constructor with FhirContext argument */ @Deprecated @@ -79,6 +77,13 @@ public class UnprocessableEntityException extends BaseServerResponseException { super(STATUS_CODE, theMessage); } + /** + * Constructor which accepts a String describing the issue. This string will be translated into an {@link IBaseOperationOutcome} resource which will be supplied in the response. + */ + public UnprocessableEntityException(String theMessage, Throwable theCause) { + super(STATUS_CODE, theMessage, theCause); + } + /** * Constructor which accepts an array of Strings describing the issue. This strings will be translated into an {@link IBaseOperationOutcome} resource which will be supplied in the response. */ diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoSearchParameterR4.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoSearchParameterR4.java index 135a12b7b69..7648d725649 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoSearchParameterR4.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoSearchParameterR4.java @@ -127,7 +127,7 @@ public class FhirResourceDaoSearchParameterR4 extends FhirResourceDaoR4 createValidationSupport() { - return ReflectionUtil.newInstanceOfFhirProfileValidationSupport("org.hl7.fhir.r4.hapi.validation.DefaultProfileValidationSupport"); + return ReflectionUtil.newInstanceOfFhirProfileValidationSupport("org.hl7.fhir.r4.hapi.ctx.DefaultProfileValidationSupport"); } @Override