Search in sources :

Example 1 with BatchResponse

use of com.b2international.snowowl.fhir.core.model.BatchResponse in project snow-owl by b2ihealthcare.

the class BundleTest method deserializeOperationOutcomeBundle.

@Test
public void deserializeOperationOutcomeBundle() throws JsonProcessingException {
    OperationOutcome operationOutcome = OperationOutcome.builder().addIssue(Issue.builder().code(IssueType.CODE_INVALID).diagnostics("Invalid code").severity(IssueSeverity.ERROR).build()).build();
    OperationOutcomeEntry operationOutcomeEntry = OperationOutcomeEntry.builder().operationOutcome(operationOutcome).response(new BatchResponse("404")).build();
    Bundle bundle = Bundle.builder().language("en").type(BundleType.BATCH_RESPONSE).addLink("self", "http://localhost:8080/snowowl/CodeSystem").addEntry(operationOutcomeEntry).build();
    String json = objectMapper.writeValueAsString(bundle);
    Bundle readBundle = objectMapper.readValue(json, Bundle.class);
    assertEquals("batch-response", readBundle.getType().getCodeValue());
}
Also used : OperationOutcomeEntry(com.b2international.snowowl.fhir.core.model.OperationOutcomeEntry) OperationOutcome(com.b2international.snowowl.fhir.core.model.OperationOutcome) BatchResponse(com.b2international.snowowl.fhir.core.model.BatchResponse) Bundle(com.b2international.snowowl.fhir.core.model.Bundle) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Aggregations

BatchResponse (com.b2international.snowowl.fhir.core.model.BatchResponse)1 Bundle (com.b2international.snowowl.fhir.core.model.Bundle)1 OperationOutcome (com.b2international.snowowl.fhir.core.model.OperationOutcome)1 OperationOutcomeEntry (com.b2international.snowowl.fhir.core.model.OperationOutcomeEntry)1 FhirTest (com.b2international.snowowl.fhir.tests.FhirTest)1 Test (org.junit.Test)1