use of org.springframework.cloud.servicebroker.model.error.ErrorMessage in project spring-cloud-open-service-broker by spring-cloud.
the class BaseControllerTest method unknownExceptionGivesExpectedStatus.
@Test
public void unknownExceptionGivesExpectedStatus() {
Exception exception = new Exception("test message");
ResponseEntity<ErrorMessage> responseEntity = controller.handleException(exception);
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR);
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 BaseControllerTest method serviceBrokerAsyncRequiredExceptionGivesExpectedStatus.
@Test
public void serviceBrokerAsyncRequiredExceptionGivesExpectedStatus() {
ServiceBrokerAsyncRequiredException exception = new ServiceBrokerAsyncRequiredException("test message");
ResponseEntity<ErrorMessage> responseEntity = controller.handleException(exception);
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.UNPROCESSABLE_ENTITY);
assertThat(responseEntity.getBody().getError()).isEqualTo(ASYNC_REQUIRED_ERROR);
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 BaseControllerTest method serviceInstanceDoesNotExistExceptionGivesExpectedStatus.
@Test
public void serviceInstanceDoesNotExistExceptionGivesExpectedStatus() {
ServiceInstanceDoesNotExistException exception = new ServiceInstanceDoesNotExistException("service-instance-id");
ResponseEntity<ErrorMessage> responseEntity = controller.handleException(exception);
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.UNPROCESSABLE_ENTITY);
assertThat(responseEntity.getBody().getError()).isNull();
assertThat(responseEntity.getBody().getMessage()).contains("id=service-instance-id");
}
use of org.springframework.cloud.servicebroker.model.error.ErrorMessage in project spring-cloud-open-service-broker by spring-cloud.
the class BaseControllerTest method serviceBrokerExceptionWithErrorCodeGivesExpectedStatus.
@Test
public void serviceBrokerExceptionWithErrorCodeGivesExpectedStatus() {
ServiceBrokerException exception = new ServiceBrokerException("ErrorCode", "test message");
ResponseEntity<ErrorMessage> responseEntity = controller.handleException(exception);
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR);
assertThat(responseEntity.getBody().getError()).isEqualTo("ErrorCode");
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 BaseControllerTest method serviceDefinitionDoesNotExistExceptionGivesExpectedStatus.
@Test
public void serviceDefinitionDoesNotExistExceptionGivesExpectedStatus() {
ServiceDefinitionDoesNotExistException exception = new ServiceDefinitionDoesNotExistException("service-definition-id");
ResponseEntity<ErrorMessage> responseEntity = controller.handleException(exception);
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.UNPROCESSABLE_ENTITY);
assertThat(responseEntity.getBody().getError()).isNull();
assertThat(responseEntity.getBody().getMessage()).contains("id=service-definition-id");
}
Aggregations