Added invalid test cases for CodeSystem/$validate-code R3
@@ -6,11 +6,9 @@ import ca.uhn.fhir.jpa.dao.dstu3.FhirResourceDaoDstu3TerminologyTest;
import ca.uhn.fhir.jpa.term.TermReindexingSvcImpl;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
-import ca.uhn.fhir.util.TestUtil;
import org.hl7.fhir.dstu3.model.*;
import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;
import org.hl7.fhir.instance.model.api.IBaseResource;
-import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.transaction.annotation.Transactional;
@@ -332,6 +330,19 @@ public class ResourceProviderDstu3CodeSystemTest extends BaseResourceProviderDst
return ourCtx.newJsonParser().parseResource(theType, loadResource(theFilename));
}
+ @Test
+ public void testValidateCodeOperation() {
+
+ Parameters inParams = new Parameters();
+ inParams.addParameter().setName("url").setValue(new UriType("https://url"));
+ inParams.addParameter().setName("code").setValue(new CodeType("1"));
+ try {
+ ourClient.operation().onType(CodeSystem.class).named("validate-code").withParameters(inParams).execute();
+ fail();
+ } catch (InvalidRequestException e) {
+ assertEquals("HTTP 400 Bad Request: Invalid request: The FHIR endpoint on this server does not know how to handle POST operation[CodeSystem/$validate-code] with parameters [[]]", e.getMessage());
+ }
+ }
}
