use of org.springframework.cloud.servicebroker.exception.ServiceBrokerException 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.exception.ServiceBrokerException 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");
}
use of org.springframework.cloud.servicebroker.exception.ServiceBrokerException in project spring-cloud-open-service-broker by spring-cloud.
the class BaseControllerTest method serviceBrokerExceptionGivesExpectedStatus.
@Test
public void serviceBrokerExceptionGivesExpectedStatus() {
ServiceBrokerException exception = new ServiceBrokerException("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.exception.ServiceBrokerException in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceBrokerExceptionHandlerTest method serviceBrokerExceptionWithErrorCode.
@Test
void serviceBrokerExceptionWithErrorCode() {
ServiceBrokerException exception = new ServiceBrokerException("ErrorCode", "test message");
ErrorMessage errorMessage = exceptionHandler.handleException(exception);
assertThat(errorMessage.getError()).isEqualTo("ErrorCode");
assertThat(errorMessage.getMessage()).contains("test message");
}
Aggregations