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() {
setupServiceInstanceServiceLastOperation(new ServiceInstanceDoesNotExistException("nonexistent-instance-id"));
client.get().uri(buildLastOperationUrl()).accept(MediaType.APPLICATION_JSON).exchange().expectStatus().is4xxClientError().expectStatus().isEqualTo(HttpStatus.BAD_REQUEST).expectBody().jsonPath("$.state").doesNotExist().jsonPath("$.description").value(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 createBindingWithUnknownServiceInstanceIdFails.
@Test
void createBindingWithUnknownServiceInstanceIdFails() throws Exception {
setupCatalogService();
given(serviceInstanceBindingService.createServiceInstanceBinding(any(CreateServiceInstanceBindingRequest.class))).willThrow(new ServiceInstanceDoesNotExistException(SERVICE_INSTANCE_ID));
MvcResult mvcResult = mockMvc.perform(put(buildCreateUrl()).content(createRequestBody).accept(MediaType.APPLICATION_JSON).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 ServiceInstanceBindingControllerIntegrationTest method createBindingWithUnknownServiceInstanceIdFails.
@Test
void createBindingWithUnknownServiceInstanceIdFails() {
setupCatalogService();
given(serviceInstanceBindingService.createServiceInstanceBinding(any(CreateServiceInstanceBindingRequest.class))).willThrow(new ServiceInstanceDoesNotExistException(SERVICE_INSTANCE_ID));
client.put().uri(buildCreateUrl()).contentType(MediaType.APPLICATION_JSON).bodyValue(createRequestBody).accept(MediaType.APPLICATION_JSON).exchange().expectStatus().is4xxClientError().expectStatus().isEqualTo(HttpStatus.UNPROCESSABLE_ENTITY).expectBody().jsonPath("$.description").isNotEmpty().consumeWith(result -> assertDescriptionContains(result, String.format("id=%s", SERVICE_INSTANCE_ID)));
}
Aggregations