Search in sources :

Example 11 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 serviceDefinitionDoesNotExistException.

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

Example 12 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 appRequiredException.

@Test
void appRequiredException() {
    ErrorMessage errorMessage = exceptionHandler.handleException(new ServiceBrokerBindingRequiresAppException("app GUID is required"));
    assertThat(errorMessage.getError()).isEqualTo(APP_REQUIRED_ERROR);
    assertThat(errorMessage.getMessage()).contains("app GUID is required");
}
Also used : ErrorMessage(org.springframework.cloud.servicebroker.model.error.ErrorMessage) ServiceBrokerBindingRequiresAppException(org.springframework.cloud.servicebroker.exception.ServiceBrokerBindingRequiresAppException) Test(org.junit.jupiter.api.Test)

Example 13 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 serviceBrokerInvalidOriginatingIdentityException.

@Test
void serviceBrokerInvalidOriginatingIdentityException() {
    ServiceBrokerInvalidOriginatingIdentityException exception = new ServiceBrokerInvalidOriginatingIdentityException("test message");
    ErrorMessage errorMessage = exceptionHandler.handleException(exception);
    assertThat(errorMessage.getError()).isNull();
    assertThat(errorMessage.getMessage()).contains("test message");
}
Also used : ServiceBrokerInvalidOriginatingIdentityException(org.springframework.cloud.servicebroker.exception.ServiceBrokerInvalidOriginatingIdentityException) ErrorMessage(org.springframework.cloud.servicebroker.model.error.ErrorMessage) Test(org.junit.jupiter.api.Test)

Example 14 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 serviceBrokerException.

@Test
void serviceBrokerException() {
    ServiceBrokerException exception = new ServiceBrokerException("test message");
    ErrorMessage errorMessage = exceptionHandler.handleException(exception);
    assertThat(errorMessage.getError()).isNull();
    assertThat(errorMessage.getMessage()).contains("test message");
}
Also used : ServiceBrokerException(org.springframework.cloud.servicebroker.exception.ServiceBrokerException) ErrorMessage(org.springframework.cloud.servicebroker.model.error.ErrorMessage) Test(org.junit.jupiter.api.Test)

Example 15 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 bindingDoesNotExistException.

@Test
void bindingDoesNotExistException() {
    ErrorMessage errorMessage = exceptionHandler.handleException(new ServiceInstanceBindingDoesNotExistException("binding-id"));
    assertThat(errorMessage.getError()).isNull();
    assertThat(errorMessage.getMessage()).contains("id=binding-id");
}
Also used : ServiceInstanceBindingDoesNotExistException(org.springframework.cloud.servicebroker.exception.ServiceInstanceBindingDoesNotExistException) 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