Search in sources :

Example 1 with ServiceBrokerApiVersionException

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

the class ServiceBrokerExceptionHandlerTest method serviceBrokerApiVersionException.

@Test
void serviceBrokerApiVersionException() {
    ServiceBrokerApiVersionException exception = new ServiceBrokerApiVersionException("expected-version", "actual-version");
    ErrorMessage errorMessage = exceptionHandler.handleException(exception);
    assertThat(errorMessage.getError()).isNull();
    assertThat(errorMessage.getMessage()).contains("expected version=expected-version");
    assertThat(errorMessage.getMessage()).contains("provided version=actual-version");
}
Also used : ServiceBrokerApiVersionException(org.springframework.cloud.servicebroker.exception.ServiceBrokerApiVersionException) ErrorMessage(org.springframework.cloud.servicebroker.model.error.ErrorMessage) Test(org.junit.jupiter.api.Test)

Example 2 with ServiceBrokerApiVersionException

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

the class BaseControllerTest method serviceBrokerApiVersionExceptionGivesExpectedStatus.

@Test
public void serviceBrokerApiVersionExceptionGivesExpectedStatus() {
    ServiceBrokerApiVersionException exception = new ServiceBrokerApiVersionException("expected-version", "actual-version");
    ResponseEntity<ErrorMessage> responseEntity = controller.handleException(exception);
    assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.PRECONDITION_FAILED);
    assertThat(responseEntity.getBody().getError()).isNull();
    assertThat(responseEntity.getBody().getMessage()).contains("expected version=expected-version");
    assertThat(responseEntity.getBody().getMessage()).contains("provided version=actual-version");
}
Also used : ServiceBrokerApiVersionException(org.springframework.cloud.servicebroker.exception.ServiceBrokerApiVersionException) ErrorMessage(org.springframework.cloud.servicebroker.model.error.ErrorMessage) Test(org.junit.Test)

Aggregations

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