use of org.springframework.cloud.servicebroker.model.error.ErrorMessage in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceBrokerExceptionHandlerTest method serviceBrokerInvalidParametersException.
@Test
void serviceBrokerInvalidParametersException() {
ServiceBrokerInvalidParametersException exception = new ServiceBrokerInvalidParametersException("test message");
ErrorMessage errorMessage = exceptionHandler.handleException(exception);
assertThat(errorMessage.getError()).isNull();
assertThat(errorMessage.getMessage()).contains("test message");
}
use of org.springframework.cloud.servicebroker.model.error.ErrorMessage 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.model.error.ErrorMessage 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");
}
use of org.springframework.cloud.servicebroker.model.error.ErrorMessage 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");
}
use of org.springframework.cloud.servicebroker.model.error.ErrorMessage in project spring-cloud-open-service-broker by spring-cloud.
the class BaseControllerTest method operationInProgressExceptionGivesExpectedStatus.
@Test
public void operationInProgressExceptionGivesExpectedStatus() {
ServiceBrokerOperationInProgressException exception = new ServiceBrokerOperationInProgressException("still working");
ResponseEntity<ErrorMessage> responseEntity = controller.handleException(exception);
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
assertThat(responseEntity.getBody().getError()).isNull();
assertThat(responseEntity.getBody().getMessage()).contains("still working");
}
Aggregations