use of org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.GENERATED in project quality-measure-and-cohort-service by Alvearie.
the class FhirTestBase method mockNotFound.
protected void mockNotFound(String resource) {
OperationOutcome outcome = new OperationOutcome();
outcome.getText().setStatusAsString("generated");
outcome.getIssueFirstRep().setSeverity(IssueSeverity.ERROR).setCode(OperationOutcome.IssueType.PROCESSING).setDiagnostics(resource);
mockFhirResourceRetrieval(get(urlMatching(resource)), getFhirParser(), outcome, getFhirServerConfig(), 404);
}
use of org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.GENERATED in project quality-measure-and-cohort-service by Alvearie.
the class CohortServiceExceptionMapperTest method testToResponseResourceNotFoundExceptionHAPIFormat.
@Test
public void testToResponseResourceNotFoundExceptionHAPIFormat() throws Exception {
OperationOutcome outcome = new OperationOutcome();
outcome.getText().setStatusAsString("generated");
outcome.getIssueFirstRep().setSeverity(IssueSeverity.ERROR).setCode(OperationOutcome.IssueType.PROCESSING).setDiagnostics("Resource Patient/something is not found");
ResourceNotFoundException ex = new ResourceNotFoundException("Error", outcome);
ex.setResponseBody(parser.encodeResourceToString(outcome));
Response response = new CohortServiceExceptionMapper().toResponse(ex);
ServiceErrorList actual = (ServiceErrorList) response.getEntity();
ServiceErrorList expected = new ServiceErrorList();
expected.setStatusCode(400);
expected.getErrors().add(newServiceError(404, "FHIR Resource Not Found: Error", "{\"resourceType\":\"OperationOutcome\",\"text\":{\"status\":\"generated\"},\"issue\":[{\"severity\":\"error\",\"code\":\"processing\",\"diagnostics\":\"Resource Patient/something is not found\"}]}"));
expected.setErrorSource(ErrorSource.FHIR_SERVER);
testErrorListEquality(expected, actual);
}
use of org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.GENERATED in project openmrs-module-fhir2 by openmrs.
the class PractitionerRoleNarrativeTest method shouldGeneratePractitionerRoleNarrative.
/**
* Check that the expected narrative is generated for some example PractitionerRole resource
*
* @throws IOException
*/
@Test
public void shouldGeneratePractitionerRoleNarrative() throws IOException {
PractitionerRole given = parser.parseResource(PractitionerRole.class, getClass().getClassLoader().getResourceAsStream(EXAMPLE_RESOURCE_PATH));
PractitionerRole result = parser.parseResource(PractitionerRole.class, parser.encodeResourceToString(given));
assertThat(result, notNullValue());
assertThat(result.getText(), notNullValue());
assertThat(result.getText().getStatusAsString(), equalTo("generated"));
assertThat(result.getText().getDivAsString(), equalTo(readNarrativeFile(EXPECTED_NARRATIVE_PATH)));
}
use of org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.GENERATED in project openmrs-module-fhir2 by openmrs.
the class RelatedPersonNarrativeTest method shouldGenerateRelatedPersonNarrative.
/**
* Check that the expected narrative is generated for some example RelatedPerson resource
*
* @throws IOException
*/
@Test
public void shouldGenerateRelatedPersonNarrative() throws IOException {
RelatedPerson given = parser.parseResource(RelatedPerson.class, getClass().getClassLoader().getResourceAsStream(EXAMPLE_RESOURCE_PATH));
RelatedPerson result = parser.parseResource(RelatedPerson.class, parser.encodeResourceToString(given));
assertThat(result, notNullValue());
assertThat(result.getText(), notNullValue());
assertThat(result.getText().getStatusAsString(), equalTo("generated"));
assertThat(result.getText().getDivAsString(), equalTo(readNarrativeFile(EXPECTED_NARRATIVE_PATH)));
}
use of org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.GENERATED in project openmrs-module-fhir2 by openmrs.
the class ConditionNarrativeTest method shouldGenerateConditionNarrative.
/**
* Check that the expected narrative is generated for some example Condition resource
*
* @throws IOException
*/
@Test
public void shouldGenerateConditionNarrative() throws IOException {
Condition given = parser.parseResource(Condition.class, getClass().getClassLoader().getResourceAsStream(EXAMPLE_RESOURCE_PATH));
Condition result = parser.parseResource(Condition.class, parser.encodeResourceToString(given));
assertThat(result, notNullValue());
assertThat(result.getText(), notNullValue());
assertThat(result.getText().getStatusAsString(), equalTo("generated"));
assertThat(result.getText().getDivAsString(), equalTo(readNarrativeFile(EXPECTED_NARRATIVE_PATH)));
}
Aggregations