use of bio.terra.model.DeleteResponseModel in project jade-data-repo by DataBiosphere.
the class DataRepoFixtures method assertGoodDeleteResponse.
private void assertGoodDeleteResponse(DataRepoResponse<DeleteResponseModel> deleteResponse) {
assertThat("delete is successful", deleteResponse.getStatusCode(), equalTo(HttpStatus.OK));
assertTrue("delete response is present", deleteResponse.getResponseObject().isPresent());
DeleteResponseModel deleteModel = deleteResponse.getResponseObject().get();
assertTrue("Valid delete response", (deleteModel.getObjectState() == DeleteResponseModel.ObjectStateEnum.DELETED || deleteModel.getObjectState() == DeleteResponseModel.ObjectStateEnum.NOT_FOUND));
}
use of bio.terra.model.DeleteResponseModel in project jade-data-repo by DataBiosphere.
the class ConnectedOperations method checkDeleteResponse.
public void checkDeleteResponse(MockHttpServletResponse response) throws Exception {
HttpStatus status = HttpStatus.valueOf(response.getStatus());
if (status.is2xxSuccessful()) {
DeleteResponseModel responseModel = TestUtils.mapFromJson(response.getContentAsString(), DeleteResponseModel.class);
assertTrue("Valid delete response object state enumeration", (responseModel.getObjectState() == DeleteResponseModel.ObjectStateEnum.DELETED || responseModel.getObjectState() == DeleteResponseModel.ObjectStateEnum.NOT_FOUND));
} else {
ErrorModel errorModel = handleFailureCase(response, HttpStatus.NOT_FOUND);
assertNotNull("error model returned", errorModel);
}
}
Aggregations