Search in sources :

Example 1 with ServiceDefinitionDoesNotExistException

use of org.springframework.cloud.servicebroker.exception.ServiceDefinitionDoesNotExistException 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");
}
Also used : ServiceDefinitionDoesNotExistException(org.springframework.cloud.servicebroker.exception.ServiceDefinitionDoesNotExistException) ErrorMessage(org.springframework.cloud.servicebroker.model.error.ErrorMessage) Test(org.junit.Test)

Example 2 with ServiceDefinitionDoesNotExistException

use of org.springframework.cloud.servicebroker.exception.ServiceDefinitionDoesNotExistException 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)

Aggregations

ServiceDefinitionDoesNotExistException (org.springframework.cloud.servicebroker.exception.ServiceDefinitionDoesNotExistException)2 ErrorMessage (org.springframework.cloud.servicebroker.model.error.ErrorMessage)2 Test (org.junit.Test)1 Test (org.junit.jupiter.api.Test)1