use of com.braintreegateway.ValidationErrors in project camel by apache.
the class CustomerGatewayIntegrationTest method testWrongCustomerCreateRequest.
@Test
public void testWrongCustomerCreateRequest() throws Exception {
// Create customer
Result<Customer> createResult = requestBody("direct://CREATE_IN_BODY", new CustomerRequest().firstName("user").lastName(UUID.randomUUID().toString()).company("Apache").email("wrongEmail").website("http://user.braintree.camel"), Result.class);
assertNotNull(createResult);
assertFalse(createResult.isSuccess());
final ValidationErrors errors = createResult.getErrors();
assertNotNull(errors);
assertNotNull(errors.getAllDeepValidationErrors());
ValidationError invalidMailError = null;
for (ValidationError error : errors.getAllDeepValidationErrors()) {
if (error.getCode() == ValidationErrorCode.CUSTOMER_EMAIL_FORMAT_IS_INVALID) {
invalidMailError = error;
break;
}
}
assertNotNull(invalidMailError);
}
Aggregations