use of org.springframework.cloud.servicebroker.exception.ServiceInstanceDoesNotExistException in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceBindingControllerIntegrationTest method deleteBindingWithUnknownInstanceIdFails.
@Test
void deleteBindingWithUnknownInstanceIdFails() throws Exception {
setupCatalogService();
doThrow(new ServiceInstanceDoesNotExistException(SERVICE_INSTANCE_ID)).when(serviceInstanceBindingService).deleteServiceInstanceBinding(any(DeleteServiceInstanceBindingRequest.class));
MvcResult mvcResult = mockMvc.perform(delete(buildDeleteUrl()).contentType(MediaType.APPLICATION_JSON)).andExpect(request().asyncStarted()).andReturn();
mockMvc.perform(asyncDispatch(mvcResult)).andExpect(status().isUnprocessableEntity()).andExpect(jsonPath("$.description", containsString(SERVICE_INSTANCE_ID)));
}
use of org.springframework.cloud.servicebroker.exception.ServiceInstanceDoesNotExistException in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceControllerIntegrationTest method deleteServiceInstanceWithUnknownIdFails.
@Test
void deleteServiceInstanceWithUnknownIdFails() throws Exception {
setupCatalogService();
setupServiceInstanceService(new ServiceInstanceDoesNotExistException(SERVICE_INSTANCE_ID));
MvcResult mvcResult = mockMvc.perform(delete(buildDeleteUrl()).accept(MediaType.APPLICATION_JSON)).andExpect(request().asyncStarted()).andReturn();
mockMvc.perform(asyncDispatch(mvcResult)).andExpect(status().isGone());
}
use of org.springframework.cloud.servicebroker.exception.ServiceInstanceDoesNotExistException in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceControllerIntegrationTest method lastOperationWithUnknownInstanceBadRequest.
@Test
void lastOperationWithUnknownInstanceBadRequest() throws Exception {
setupServiceInstanceServiceLastOperation(new ServiceInstanceDoesNotExistException("nonexistent-instance-id"));
MvcResult mvcResult = mockMvc.perform(get(buildLastOperationUrl())).andExpect(request().asyncStarted()).andReturn();
mockMvc.perform(asyncDispatch(mvcResult)).andExpect(status().isBadRequest()).andExpect(jsonPath("$.state").doesNotExist()).andExpect(jsonPath("$.description", containsString("The requested Service Instance does not exist")));
}
use of org.springframework.cloud.servicebroker.exception.ServiceInstanceDoesNotExistException in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceBindingControllerIntegrationTest method deleteBindingWithUnknownInstanceIdFails.
@Test
void deleteBindingWithUnknownInstanceIdFails() {
setupCatalogService();
given(serviceInstanceBindingService.deleteServiceInstanceBinding(any(DeleteServiceInstanceBindingRequest.class))).willThrow(new ServiceInstanceDoesNotExistException(SERVICE_INSTANCE_ID));
client.delete().uri(buildDeleteUrl()).exchange().expectStatus().is4xxClientError().expectStatus().isEqualTo(HttpStatus.UNPROCESSABLE_ENTITY).expectBody().jsonPath("$.description").isNotEmpty().consumeWith(result -> assertDescriptionContains(result, SERVICE_INSTANCE_ID));
}
use of org.springframework.cloud.servicebroker.exception.ServiceInstanceDoesNotExistException in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceBrokerExceptionHandlerTest method serviceInstanceDoesNotExistException.
@Test
void serviceInstanceDoesNotExistException() {
ServiceInstanceDoesNotExistException exception = new ServiceInstanceDoesNotExistException("service-instance-id");
ErrorMessage errorMessage = exceptionHandler.handleException(exception);
assertThat(errorMessage.getError()).isNull();
assertThat(errorMessage.getMessage()).contains("id=service-instance-id");
}
Aggregations