Search in sources :

Example 36 with ErrorMessage

use of org.springframework.cloud.servicebroker.model.error.ErrorMessage in project spring-cloud-open-service-broker by spring-cloud.

the class ServiceBrokerExceptionHandlerTest method serviceInstanceDoesNotExistException.

@Test
void serviceInstanceDoesNotExistException() {
    ServiceInstanceDoesNotExistException exception = new ServiceInstanceDoesNotExistException("service-instance-id");
    ErrorMessage errorMessage = exceptionHandler.handleException(exception);
    assertThat(errorMessage.getError()).isNull();
    assertThat(errorMessage.getMessage()).contains("id=service-instance-id");
}
Also used : ServiceInstanceDoesNotExistException(org.springframework.cloud.servicebroker.exception.ServiceInstanceDoesNotExistException) ErrorMessage(org.springframework.cloud.servicebroker.model.error.ErrorMessage) Test(org.junit.jupiter.api.Test)

Example 37 with ErrorMessage

use of org.springframework.cloud.servicebroker.model.error.ErrorMessage in project spring-cloud-open-service-broker by spring-cloud.

the class ServiceBrokerExceptionHandlerTest method serviceDefinitionPlanDoesNotExistException.

@Test
void serviceDefinitionPlanDoesNotExistException() {
    ServiceDefinitionPlanDoesNotExistException exception = new ServiceDefinitionPlanDoesNotExistException("service-definition-plan-id");
    ErrorMessage errorMessage = exceptionHandler.handleException(exception);
    assertThat(errorMessage.getError()).isNull();
    assertThat(errorMessage.getMessage()).contains("Service Definition Plan does not exist: " + "id=service-definition-plan-id");
}
Also used : ErrorMessage(org.springframework.cloud.servicebroker.model.error.ErrorMessage) ServiceDefinitionPlanDoesNotExistException(org.springframework.cloud.servicebroker.exception.ServiceDefinitionPlanDoesNotExistException) Test(org.junit.jupiter.api.Test)

Example 38 with ErrorMessage

use of org.springframework.cloud.servicebroker.model.error.ErrorMessage 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)

Example 39 with ErrorMessage

use of org.springframework.cloud.servicebroker.model.error.ErrorMessage in project spring-cloud-open-service-broker by spring-cloud.

the class ServiceBrokerExceptionHandlerTest method bindingExistsException.

@Test
void bindingExistsException() {
    ErrorMessage errorMessage = exceptionHandler.handleException(new ServiceInstanceBindingExistsException("service-instance-id", "binding-id"));
    assertThat(errorMessage.getError()).isNull();
    assertThat(errorMessage.getMessage()).contains("serviceInstanceId=service-instance-id").contains("bindingId=binding-id");
}
Also used : ServiceInstanceBindingExistsException(org.springframework.cloud.servicebroker.exception.ServiceInstanceBindingExistsException) ErrorMessage(org.springframework.cloud.servicebroker.model.error.ErrorMessage) Test(org.junit.jupiter.api.Test)

Example 40 with ErrorMessage

use of org.springframework.cloud.servicebroker.model.error.ErrorMessage in project spring-cloud-open-service-broker by spring-cloud.

the class ServiceBrokerWebFluxExceptionHandlerTest method stringParameterIsNotPresent.

@Test
void stringParameterIsNotPresent() throws NoSuchMethodException {
    Method method = this.getClass().getMethod("setUp", (Class<?>[]) null);
    MethodParameter parameter = new MethodParameter(method, -1);
    ServerWebInputException exception = new ServerWebInputException("reason", parameter);
    ErrorMessage errorMessage = exceptionHandler.handleException(exception);
    assertThat(errorMessage.getError()).isNull();
    assertThat(errorMessage.getMessage()).contains("reason");
}
Also used : ServerWebInputException(org.springframework.web.server.ServerWebInputException) Method(java.lang.reflect.Method) MethodParameter(org.springframework.core.MethodParameter) ErrorMessage(org.springframework.cloud.servicebroker.model.error.ErrorMessage) Test(org.junit.jupiter.api.Test)

Aggregations

ErrorMessage (org.springframework.cloud.servicebroker.model.error.ErrorMessage)41 Test (org.junit.jupiter.api.Test)23 Test (org.junit.Test)18 ServiceBrokerException (org.springframework.cloud.servicebroker.exception.ServiceBrokerException)6 Method (java.lang.reflect.Method)5 MethodParameter (org.springframework.core.MethodParameter)5 ServiceBrokerApiVersionException (org.springframework.cloud.servicebroker.exception.ServiceBrokerApiVersionException)4 ServiceBrokerAsyncRequiredException (org.springframework.cloud.servicebroker.exception.ServiceBrokerAsyncRequiredException)4 ServiceBrokerConcurrencyException (org.springframework.cloud.servicebroker.exception.ServiceBrokerConcurrencyException)4 ServiceBrokerInvalidParametersException (org.springframework.cloud.servicebroker.exception.ServiceBrokerInvalidParametersException)4 ServiceBrokerOperationInProgressException (org.springframework.cloud.servicebroker.exception.ServiceBrokerOperationInProgressException)4 ServiceBrokerUnavailableException (org.springframework.cloud.servicebroker.exception.ServiceBrokerUnavailableException)4 ServiceDefinitionDoesNotExistException (org.springframework.cloud.servicebroker.exception.ServiceDefinitionDoesNotExistException)4 ServiceInstanceDoesNotExistException (org.springframework.cloud.servicebroker.exception.ServiceInstanceDoesNotExistException)4 BindingResult (org.springframework.validation.BindingResult)4 FieldError (org.springframework.validation.FieldError)4 MapBindingResult (org.springframework.validation.MapBindingResult)4 ServiceBrokerBindingRequiresAppException (org.springframework.cloud.servicebroker.exception.ServiceBrokerBindingRequiresAppException)3 ServiceDefinitionPlanDoesNotExistException (org.springframework.cloud.servicebroker.exception.ServiceDefinitionPlanDoesNotExistException)3 ServiceInstanceBindingExistsException (org.springframework.cloud.servicebroker.exception.ServiceInstanceBindingExistsException)3