use of org.springframework.cloud.servicebroker.model.error.ErrorMessage in project spring-cloud-open-service-broker by spring-cloud.
the class BaseControllerTest method serviceBrokerInvalidParametersExceptionGivesExpectedStatus.
@Test
public void serviceBrokerInvalidParametersExceptionGivesExpectedStatus() {
ServiceBrokerInvalidParametersException exception = new ServiceBrokerInvalidParametersException("test message");
ResponseEntity<ErrorMessage> responseEntity = controller.handleException(exception);
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.UNPROCESSABLE_ENTITY);
assertThat(responseEntity.getBody().getError()).isNull();
assertThat(responseEntity.getBody().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 ServiceInstanceBindingControllerResponseCodeTest method appRequiredExistsGivesExpectedStatus.
@Test
public void appRequiredExistsGivesExpectedStatus() {
ResponseEntity<ErrorMessage> responseEntity = controller.handleException(new ServiceBrokerBindingRequiresAppException("app GUID is required"));
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.UNPROCESSABLE_ENTITY);
assertThat(responseEntity.getBody().getError()).isEqualTo(APP_REQUIRED_ERROR);
assertThat(responseEntity.getBody().getMessage()).contains("app GUID is required");
}
use of org.springframework.cloud.servicebroker.model.error.ErrorMessage in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceBrokerExceptionHandlerTest method unknownException.
@Test
void unknownException() {
Exception exception = new Exception("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 serviceBrokerAsyncRequiredException.
@Test
void serviceBrokerAsyncRequiredException() {
ServiceBrokerAsyncRequiredException exception = new ServiceBrokerAsyncRequiredException("test message");
ErrorMessage errorMessage = exceptionHandler.handleException(exception);
assertThat(errorMessage.getError()).isEqualTo(ASYNC_REQUIRED_ERROR);
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 serviceBrokerUnavailableException.
@Test
void serviceBrokerUnavailableException() {
ServiceBrokerUnavailableException exception = new ServiceBrokerUnavailableException("maintenance in progress");
ErrorMessage errorMessage = exceptionHandler.handleException(exception);
assertThat(errorMessage.getError()).isNull();
assertThat(errorMessage.getMessage()).contains("maintenance in progress");
}
Aggregations