use of org.springframework.cloud.servicebroker.model.error.ErrorMessage in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceBindingControllerResponseCodeTest method bindingExistsGivesExpectedStatus.
@Test
public void bindingExistsGivesExpectedStatus() {
ResponseEntity<ErrorMessage> responseEntity = controller.handleException(new ServiceInstanceBindingExistsException("service-instance-id", "binding-id"));
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.CONFLICT);
assertThat(responseEntity.getBody().getError()).isNull();
assertThat(responseEntity.getBody().getMessage()).contains("serviceInstanceId=service-instance-id").contains("bindingId=binding-id");
}
use of org.springframework.cloud.servicebroker.model.error.ErrorMessage in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceControllerResponseCodeTest method serviceInstanceUpdateNotSupportedExceptionGivesExpectedStatus.
@Test
public void serviceInstanceUpdateNotSupportedExceptionGivesExpectedStatus() {
ServiceInstanceUpdateNotSupportedException exception = new ServiceInstanceUpdateNotSupportedException("test exception");
ResponseEntity<ErrorMessage> responseEntity = controller.handleException(exception);
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.UNPROCESSABLE_ENTITY);
assertThat(responseEntity.getBody().getMessage()).contains("test exception");
}
use of org.springframework.cloud.servicebroker.model.error.ErrorMessage in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceControllerResponseCodeTest method serviceInstanceExistsExceptionGivesExpectedStatus.
@Test
public void serviceInstanceExistsExceptionGivesExpectedStatus() {
ServiceInstanceExistsException exception = new ServiceInstanceExistsException("service-instance-id", "service-definition-id");
ResponseEntity<ErrorMessage> responseEntity = controller.handleException(exception);
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.CONFLICT);
assertThat(responseEntity.getBody().getMessage()).contains("serviceInstanceId=service-instance-id");
assertThat(responseEntity.getBody().getMessage()).contains("serviceDefinitionId=service-definition-id");
}
use of org.springframework.cloud.servicebroker.model.error.ErrorMessage in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceBrokerExceptionHandlerTest method serviceInstanceUpdateNotSupportedException.
@Test
void serviceInstanceUpdateNotSupportedException() {
ServiceInstanceUpdateNotSupportedException exception = new ServiceInstanceUpdateNotSupportedException("test exception");
ErrorMessage errorMessage = exceptionHandler.handleException(exception);
assertThat(errorMessage.getMessage()).contains("test exception");
}
use of org.springframework.cloud.servicebroker.model.error.ErrorMessage 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