Unit test fix
This commit is contained in:
parent
a4e4111376
commit
75a68a0332
|
@ -20,12 +20,11 @@ package ca.uhn.fhir.rest.server.exceptions;
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.rest.api.Constants;
|
import ca.uhn.fhir.rest.api.Constants;
|
||||||
import ca.uhn.fhir.util.CoverageIgnore;
|
import ca.uhn.fhir.util.CoverageIgnore;
|
||||||
import ca.uhn.fhir.util.OperationOutcomeUtil;
|
import ca.uhn.fhir.util.OperationOutcomeUtil;
|
||||||
|
import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an <b>HTTP 422 Unprocessable Entity</b> response, which means that a resource was rejected by the server because it "violated applicable FHIR profiles or server business rules".
|
* Represents an <b>HTTP 422 Unprocessable Entity</b> response, which means that a resource was rejected by the server because it "violated applicable FHIR profiles or server business rules".
|
||||||
|
@ -39,15 +38,14 @@ import ca.uhn.fhir.util.OperationOutcomeUtil;
|
||||||
@CoverageIgnore
|
@CoverageIgnore
|
||||||
public class UnprocessableEntityException extends BaseServerResponseException {
|
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 String DEFAULT_MESSAGE = "Unprocessable Entity";
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
public static final int STATUS_CODE = Constants.STATUS_HTTP_422_UNPROCESSABLE_ENTITY;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param theMessage
|
* @param theMessage The message to add to the status line
|
||||||
* The message to add to the status line
|
|
||||||
* @param theOperationOutcome The {@link IBaseOperationOutcome} resource to return to the client
|
* @param theOperationOutcome The {@link IBaseOperationOutcome} resource to return to the client
|
||||||
*/
|
*/
|
||||||
public UnprocessableEntityException(String theMessage, IBaseOperationOutcome theOperationOutcome) {
|
public UnprocessableEntityException(String theMessage, IBaseOperationOutcome theOperationOutcome) {
|
||||||
|
@ -79,6 +77,13 @@ public class UnprocessableEntityException extends BaseServerResponseException {
|
||||||
super(STATUS_CODE, theMessage);
|
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.
|
* 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.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -127,7 +127,7 @@ public class FhirResourceDaoSearchParameterR4 extends FhirResourceDaoR4<SearchPa
|
||||||
theContext.newFluentPath().evaluate(temporaryInstance, nextPath, IBase.class);
|
theContext.newFluentPath().evaluate(temporaryInstance, nextPath, IBase.class);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String msg = theContext.getLocalizer().getMessage(FhirResourceDaoSearchParameterR4.class, "invalidSearchParamExpression", nextPath, e.getMessage());
|
String msg = theContext.getLocalizer().getMessage(FhirResourceDaoSearchParameterR4.class, "invalidSearchParamExpression", nextPath, e.getMessage());
|
||||||
throw new UnprocessableEntityException(msg);
|
throw new UnprocessableEntityException(msg, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class FhirR4 implements IFhirVersion {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IContextValidationSupport<?, ?, ?, ?, ?, ?> createValidationSupport() {
|
public IContextValidationSupport<?, ?, ?, ?, ?, ?> createValidationSupport() {
|
||||||
return ReflectionUtil.newInstanceOfFhirProfileValidationSupport("org.hl7.fhir.r4.hapi.validation.DefaultProfileValidationSupport");
|
return ReflectionUtil.newInstanceOfFhirProfileValidationSupport("org.hl7.fhir.r4.hapi.ctx.DefaultProfileValidationSupport");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue