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");
}
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");
}
Aggregations