Skip to content

Commit

Permalink
issue #2526 - updte the expected error strings in ServerSpecTest
Browse files Browse the repository at this point in the history
Previously we were not encoding the apostrophe in the result message but
now we are.

Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
  • Loading branch information
lmsurpre committed Jul 8, 2021
1 parent 82a7f2b commit 1c21388
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
import java.time.ZoneOffset;
import java.util.UUID;

import jakarta.json.Json;
import jakarta.json.JsonBuilderFactory;
import jakarta.json.JsonObject;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.Response;
Expand Down Expand Up @@ -50,6 +47,10 @@
import com.ibm.fhir.model.type.code.ObservationStatus;
import com.ibm.fhir.model.util.FHIRUtil;

import jakarta.json.Json;
import jakarta.json.JsonBuilderFactory;
import jakarta.json.JsonObject;

/**
* This class tests the REST API's compliance with the FHIR spec in terms of status code and OperationOutcome responses,
* etc.
Expand Down Expand Up @@ -427,7 +428,7 @@ public void testReadErrorInvalidResourceType() {
WebTarget target = getWebTarget();
Response response = target.path("BogusResourceType/1").request(FHIRMediaType.APPLICATION_FHIR_JSON).get();
assertResponse(response, Response.Status.NOT_FOUND.getStatusCode());
assertExceptionOperationOutcome(response.readEntity(OperationOutcome.class), "'BogusResourceType' is not a valid resource type.");
assertExceptionOperationOutcome(response.readEntity(OperationOutcome.class), "&#39;BogusResourceType&#39; is not a valid resource type.");
}

// Test: retrieve non-existent Patient.
Expand Down Expand Up @@ -463,7 +464,7 @@ public void testVReadInvalidResourceType() {
WebTarget target = getWebTarget();
Response response = target.path("BogusResourceType/1/_history/1").request(FHIRMediaType.APPLICATION_FHIR_JSON).get();
assertResponse(response, Response.Status.NOT_FOUND.getStatusCode());
assertExceptionOperationOutcome(response.readEntity(OperationOutcome.class), "'BogusResourceType' is not a valid resource type.");
assertExceptionOperationOutcome(response.readEntity(OperationOutcome.class), "&#39;BogusResourceType&#39; is not a valid resource type.");
}

// Test: retrieve invalid version.
Expand Down Expand Up @@ -499,7 +500,7 @@ public void testHistoryInvalidResourceType() {
WebTarget target = getWebTarget();
Response response = target.path("Bogus/123456789ABCDEF/_history").request(FHIRMediaType.APPLICATION_FHIR_JSON).get();
assertResponse(response, Response.Status.NOT_FOUND.getStatusCode());
assertExceptionOperationOutcome(response.readEntity(OperationOutcome.class), "'Bogus' is not a valid resource type.");
assertExceptionOperationOutcome(response.readEntity(OperationOutcome.class), "&#39;Bogus&#39; is not a valid resource type.");
}

@Test(groups = { "server-spec" }, dependsOnMethods={"testCreatePatient"})
Expand Down Expand Up @@ -557,7 +558,7 @@ public void testSearchInvalidResourceType() {
WebTarget target = getWebTarget();
Response response = target.path("NotAResourceType").queryParam("notasearchparameter", "foo").request(FHIRMediaType.APPLICATION_FHIR_JSON).get();
assertResponse(response, Response.Status.NOT_FOUND.getStatusCode());
assertExceptionOperationOutcome(response.readEntity(OperationOutcome.class), "'NotAResourceType' is not a valid resource type.");
assertExceptionOperationOutcome(response.readEntity(OperationOutcome.class), "&#39;NotAResourceType&#39; is not a valid resource type.");
}

@Test(groups = { "server-spec" }, dependsOnMethods={"testCreatePatient"})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1958,6 +1958,7 @@ private Entry processEntryForGet(Entry.Request entryRequest, FHIRUrlParser reque
} else if (pathTokens.length == 3) {
if ("_history".equals(pathTokens[2])) {
// This is a 'history' request.
checkResourceType(pathTokens[0]);
resource = doHistory(pathTokens[0], pathTokens[1], queryParams, absoluteUri);
} else {
// This is a compartment based search
Expand Down

0 comments on commit 1c21388

Please sign in to comment.