Search in sources :

Example 1 with ServiceBrokerUnavailableException

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

the class ServiceBrokerExceptionHandlerTest method serviceBrokerUnavailableException.

@Test
void serviceBrokerUnavailableException() {
    ServiceBrokerUnavailableException exception = new ServiceBrokerUnavailableException("maintenance in progress");
    ErrorMessage errorMessage = exceptionHandler.handleException(exception);
    assertThat(errorMessage.getError()).isNull();
    assertThat(errorMessage.getMessage()).contains("maintenance in progress");
}
Also used : ServiceBrokerUnavailableException(org.springframework.cloud.servicebroker.exception.ServiceBrokerUnavailableException) ErrorMessage(org.springframework.cloud.servicebroker.model.error.ErrorMessage) Test(org.junit.jupiter.api.Test)

Example 2 with ServiceBrokerUnavailableException

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

the class BaseControllerTest method serviceBrokerUnavailableExceptionGivesExpectedStatus.

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

Aggregations

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