}
@Test
public void testInsertingPatient() throws Exception {
Patient testPatientToInsert = this.createTestPatient();
ResultActions resultActions = null;
ApiResponse<Patient> retrievedPatient = null;
try {
resultActions = this.mockMvc.perform(post("/patients").content(convertObjectToBytes(testPatientToInsert)).contentType(MediaType.APPLICATION_JSON));
LOG.debug("RestultActons: " + resultActions.andReturn().getResponse().getContentAsString()) ;
resultActions.andExpect(status().isOk())
.andExpect(content().string(notNullValue()));
} finally {
if (resultActions != null) {
retrievedPatient = this.jsonToObject(resultActions.andReturn().getResponse().getContentAsString());
if (retrievedPatient != null && retrievedPatient.getPayload() != null){
patientService.deletePatient(retrievedPatient.getPayload().getId());
}
}
}