Thanks James!
I have tried to add methodOutcome.setResource(communication)
MethodOutcome methodOutcome = new MethodOutcome();
methodOutcome.setId(new IdType(ResourceType.Communication.name(), communication.getId(), "1"));
methodOutcome.setResource(communication);
methodOutcome.setCreated(true);
log.info(" return create methodOutcome {}", methodOutcome);
return methodOutcome;
But I have found this exception:
A couple of more questions, we are trying to test all our providers with Integration test. We have some issues with jackson. Do you have any examples of test providers? we have endpoints Create, Put, Post ...
* GET method: running fine, but we are parsing to strings, no to entity.
ResponseEntity<String> entity = this.restTemplate.getForEntity("/fhir/Device/" + deviceId, String.class);
Assertions.assertEquals(entity.getStatusCode(), HttpStatus.OK);
* Post method: with restTemplate.postForEntity looks fine.
String jsonCommunication = Util.getFileContent("communication.json");
HttpHeaders headers = new HttpHeaders();
headers.set(HttpHeaders.CONTENT_TYPE, "application/fhir+json");
headers.add(HttpHeaders.ACCEPT, "application/fhir+json");
HttpEntity<String> entity = new HttpEntity<>(jsonCommunication, headers);
ResponseEntity<MethodOutcome> responseEntity = restTemplate.postForEntity("/fhir/Communication", entity, MethodOutcome.class);
Assertions.assertEquals(responseEntity.getStatusCode(), HttpStatus.CREATED);
we don't know how to test this type of endpoints due to the need to add the headers with the fhir+json content_type. Do you know how to test these types of endpoints? or do you know where we can find examples?