Search in sources :

Example 1 with ServiceBrokerConcurrencyException

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

the class BaseControllerTest method serviceBrokerConcurrencyExceptionGivesExpectedStatus.

@Test
public void serviceBrokerConcurrencyExceptionGivesExpectedStatus() {
    ServiceBrokerConcurrencyException exception = new ServiceBrokerConcurrencyException("operation in progress");
    ResponseEntity<ErrorMessage> responseEntity = controller.handleException(exception);
    assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.UNPROCESSABLE_ENTITY);
    assertThat(responseEntity.getBody().getError()).isEqualTo(CONCURRENCY_ERROR);
    assertThat(responseEntity.getBody().getMessage()).contains("operation in progress");
}
Also used : ServiceBrokerConcurrencyException(org.springframework.cloud.servicebroker.exception.ServiceBrokerConcurrencyException) ErrorMessage(org.springframework.cloud.servicebroker.model.error.ErrorMessage) Test(org.junit.Test)

Example 2 with ServiceBrokerConcurrencyException

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

the class ServiceBrokerExceptionHandlerTest method serviceBrokerConcurrencyException.

@Test
void serviceBrokerConcurrencyException() {
    ServiceBrokerConcurrencyException exception = new ServiceBrokerConcurrencyException("operation in progress");
    ErrorMessage errorMessage = exceptionHandler.handleException(exception);
    assertThat(errorMessage.getError()).isEqualTo(CONCURRENCY_ERROR);
    assertThat(errorMessage.getMessage()).contains("operation in progress");
}
Also used : ServiceBrokerConcurrencyException(org.springframework.cloud.servicebroker.exception.ServiceBrokerConcurrencyException) ErrorMessage(org.springframework.cloud.servicebroker.model.error.ErrorMessage) Test(org.junit.jupiter.api.Test)

Aggregations

ServiceBrokerConcurrencyException (org.springframework.cloud.servicebroker.exception.ServiceBrokerConcurrencyException)2 ErrorMessage (org.springframework.cloud.servicebroker.model.error.ErrorMessage)2 Test (org.junit.Test)1 Test (org.junit.jupiter.api.Test)1