Search in sources :

Example 1 with ServiceBrokerBindingRequiresAppException

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

Example 2 with ServiceBrokerBindingRequiresAppException

use of org.springframework.cloud.servicebroker.exception.ServiceBrokerBindingRequiresAppException in project spring-cloud-open-service-broker by spring-cloud.

the class ServiceBrokerExceptionHandlerTest method appRequiredException.

@Test
void appRequiredException() {
    ErrorMessage errorMessage = exceptionHandler.handleException(new ServiceBrokerBindingRequiresAppException("app GUID is required"));
    assertThat(errorMessage.getError()).isEqualTo(APP_REQUIRED_ERROR);
    assertThat(errorMessage.getMessage()).contains("app GUID is required");
}
Also used : ErrorMessage(org.springframework.cloud.servicebroker.model.error.ErrorMessage) ServiceBrokerBindingRequiresAppException(org.springframework.cloud.servicebroker.exception.ServiceBrokerBindingRequiresAppException) Test(org.junit.jupiter.api.Test)

Aggregations

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