use of org.springframework.cloud.servicebroker.exception.ServiceBrokerInvalidParametersException in project spring-cloud-open-service-broker by spring-cloud.
the class BaseControllerTest method serviceBrokerInvalidParametersExceptionGivesExpectedStatus.
@Test
public void serviceBrokerInvalidParametersExceptionGivesExpectedStatus() {
ServiceBrokerInvalidParametersException exception = new ServiceBrokerInvalidParametersException("test message");
ResponseEntity<ErrorMessage> responseEntity = controller.handleException(exception);
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.UNPROCESSABLE_ENTITY);
assertThat(responseEntity.getBody().getError()).isNull();
assertThat(responseEntity.getBody().getMessage()).contains("test message");
}
use of org.springframework.cloud.servicebroker.exception.ServiceBrokerInvalidParametersException in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceBrokerExceptionHandlerTest method serviceBrokerInvalidParametersException.
@Test
void serviceBrokerInvalidParametersException() {
ServiceBrokerInvalidParametersException exception = new ServiceBrokerInvalidParametersException("test message");
ErrorMessage errorMessage = exceptionHandler.handleException(exception);
assertThat(errorMessage.getError()).isNull();
assertThat(errorMessage.getMessage()).contains("test message");
}
use of org.springframework.cloud.servicebroker.exception.ServiceBrokerInvalidParametersException in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceControllerIntegrationTest method createServiceInstanceWithInvalidParametersFails.
@Test
void createServiceInstanceWithInvalidParametersFails() {
setupCatalogService();
setupServiceInstanceService(new ServiceBrokerInvalidParametersException("invalid parameters description"));
client.put().uri(buildCreateUpdateUrl()).contentType(MediaType.APPLICATION_JSON).bodyValue(createRequestBody).accept(MediaType.APPLICATION_JSON).exchange().expectStatus().is4xxClientError().expectStatus().isBadRequest().expectBody().jsonPath("$.description").isNotEmpty().consumeWith(result -> assertDescriptionContains(result, "invalid parameters description"));
}
use of org.springframework.cloud.servicebroker.exception.ServiceBrokerInvalidParametersException in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceControllerIntegrationTest method createServiceInstanceWithInvalidParametersFails.
@Test
void createServiceInstanceWithInvalidParametersFails() throws Exception {
setupCatalogService();
setupServiceInstanceService(new ServiceBrokerInvalidParametersException("invalid parameters description"));
MvcResult mvcResult = mockMvc.perform(put(buildCreateUpdateUrl()).content(createRequestBody).contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)).andExpect(request().asyncStarted()).andReturn();
mockMvc.perform(asyncDispatch(mvcResult)).andExpect(status().isBadRequest()).andExpect(jsonPath("$.description", endsWith("invalid parameters description")));
}
Aggregations