Search in sources :

Example 1 with ServiceInstanceUpdateNotSupportedException

use of org.springframework.cloud.servicebroker.exception.ServiceInstanceUpdateNotSupportedException in project spring-cloud-open-service-broker by spring-cloud.

the class ServiceInstanceControllerIntegrationTest method updateServiceInstanceWithUnsupportedOperationFails.

@Test
void updateServiceInstanceWithUnsupportedOperationFails() throws Exception {
    setupCatalogService();
    setupServiceInstanceService(new ServiceInstanceUpdateNotSupportedException("description"));
    MvcResult mvcResult = mockMvc.perform(patch(buildCreateUpdateUrl()).content(updateRequestBody).contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)).andExpect(request().asyncStarted()).andReturn();
    mockMvc.perform(asyncDispatch(mvcResult)).andExpect(status().isUnprocessableEntity()).andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)).andExpect(jsonPath("$.description", containsString("description")));
}
Also used : ServiceInstanceUpdateNotSupportedException(org.springframework.cloud.servicebroker.exception.ServiceInstanceUpdateNotSupportedException) MvcResult(org.springframework.test.web.servlet.MvcResult) AbstractServiceInstanceControllerIntegrationTest(org.springframework.cloud.servicebroker.autoconfigure.web.AbstractServiceInstanceControllerIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 2 with ServiceInstanceUpdateNotSupportedException

use of org.springframework.cloud.servicebroker.exception.ServiceInstanceUpdateNotSupportedException in project spring-cloud-open-service-broker by spring-cloud.

the class ServiceInstanceControllerResponseCodeTest method serviceInstanceUpdateNotSupportedExceptionGivesExpectedStatus.

@Test
public void serviceInstanceUpdateNotSupportedExceptionGivesExpectedStatus() {
    ServiceInstanceUpdateNotSupportedException exception = new ServiceInstanceUpdateNotSupportedException("test exception");
    ResponseEntity<ErrorMessage> responseEntity = controller.handleException(exception);
    assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.UNPROCESSABLE_ENTITY);
    assertThat(responseEntity.getBody().getMessage()).contains("test exception");
}
Also used : ServiceInstanceUpdateNotSupportedException(org.springframework.cloud.servicebroker.exception.ServiceInstanceUpdateNotSupportedException) ErrorMessage(org.springframework.cloud.servicebroker.model.error.ErrorMessage) Test(org.junit.Test)

Example 3 with ServiceInstanceUpdateNotSupportedException

use of org.springframework.cloud.servicebroker.exception.ServiceInstanceUpdateNotSupportedException in project spring-cloud-open-service-broker by spring-cloud.

the class ServiceBrokerExceptionHandlerTest method serviceInstanceUpdateNotSupportedException.

@Test
void serviceInstanceUpdateNotSupportedException() {
    ServiceInstanceUpdateNotSupportedException exception = new ServiceInstanceUpdateNotSupportedException("test exception");
    ErrorMessage errorMessage = exceptionHandler.handleException(exception);
    assertThat(errorMessage.getMessage()).contains("test exception");
}
Also used : ServiceInstanceUpdateNotSupportedException(org.springframework.cloud.servicebroker.exception.ServiceInstanceUpdateNotSupportedException) ErrorMessage(org.springframework.cloud.servicebroker.model.error.ErrorMessage) Test(org.junit.jupiter.api.Test)

Example 4 with ServiceInstanceUpdateNotSupportedException

use of org.springframework.cloud.servicebroker.exception.ServiceInstanceUpdateNotSupportedException in project spring-cloud-open-service-broker by spring-cloud.

the class ServiceInstanceControllerIntegrationTest method updateServiceInstanceWithUnsupportedOperationFails.

@Test
void updateServiceInstanceWithUnsupportedOperationFails() {
    setupCatalogService();
    setupServiceInstanceService(new ServiceInstanceUpdateNotSupportedException("description"));
    client.patch().uri(buildCreateUpdateUrl()).contentType(MediaType.APPLICATION_JSON).bodyValue(updateRequestBody).accept(MediaType.APPLICATION_JSON).exchange().expectStatus().is4xxClientError().expectStatus().isEqualTo(HttpStatus.UNPROCESSABLE_ENTITY).expectHeader().contentTypeCompatibleWith(MediaType.APPLICATION_JSON).expectBody().jsonPath("$.description").isNotEmpty().consumeWith(result -> assertDescriptionContains(result, "description"));
}
Also used : ServiceInstanceUpdateNotSupportedException(org.springframework.cloud.servicebroker.exception.ServiceInstanceUpdateNotSupportedException) AbstractServiceInstanceControllerIntegrationTest(org.springframework.cloud.servicebroker.autoconfigure.web.AbstractServiceInstanceControllerIntegrationTest) Test(org.junit.jupiter.api.Test)

Aggregations

ServiceInstanceUpdateNotSupportedException (org.springframework.cloud.servicebroker.exception.ServiceInstanceUpdateNotSupportedException)4 Test (org.junit.jupiter.api.Test)3 AbstractServiceInstanceControllerIntegrationTest (org.springframework.cloud.servicebroker.autoconfigure.web.AbstractServiceInstanceControllerIntegrationTest)2 ErrorMessage (org.springframework.cloud.servicebroker.model.error.ErrorMessage)2 Test (org.junit.Test)1 MvcResult (org.springframework.test.web.servlet.MvcResult)1