use of org.hibernate.validator.test.internal.engine.methodvalidation.service.CustomerRepositoryImpl in project hibernate-validator by hibernate.
the class AbstractConstructorValidationTest method cascadedConstructorParameterValidationYieldsConstraintViolation.
@Test
public void cascadedConstructorParameterValidationYieldsConstraintViolation() throws Exception {
Set<ConstraintViolation<CustomerRepositoryImpl>> violations = executableValidator.validateConstructorParameters(CustomerRepositoryImpl.class.getConstructor(Customer.class), new Customer[] { new Customer(null) });
assertThat(violations).containsOnlyViolations(violationOf(NotNull.class).withMessage(messagePrefix() + "must not be null").withInvalidValue(null).withRootBeanClass(CustomerRepositoryImpl.class).withPropertyPath(pathWith().constructor(CustomerRepositoryImpl.class).parameter("customer", 0).property("name")));
}
use of org.hibernate.validator.test.internal.engine.methodvalidation.service.CustomerRepositoryImpl in project hibernate-validator by hibernate.
the class AbstractMethodValidationTest method createProxy.
protected void createProxy(Class<?>... groups) {
customerRepositoryOriginalBean = new CustomerRepositoryImpl();
customerRepositoryValidatingProxy = getValidatingProxy(customerRepositoryOriginalBean, validator, groups);
repositoryBase = customerRepositoryValidatingProxy;
}
use of org.hibernate.validator.test.internal.engine.methodvalidation.service.CustomerRepositoryImpl in project hibernate-validator by hibernate.
the class WrongMethodOrParameterForMethodValidationTest method setUp.
@BeforeClass
public void setUp() {
validator = ValidatorUtil.getValidator().forExecutables();
customerRepository = new CustomerRepositoryImpl();
}
use of org.hibernate.validator.test.internal.engine.methodvalidation.service.CustomerRepositoryImpl in project hibernate-validator by hibernate.
the class AbstractConstructorValidationTest method cascadedConstructorReturnValueValidationYieldsConstraintViolation.
@Test
public void cascadedConstructorReturnValueValidationYieldsConstraintViolation() throws Exception {
CustomerRepositoryImpl customerRepository = new CustomerRepositoryImpl();
Set<ConstraintViolation<CustomerRepositoryImpl>> violations = executableValidator.validateConstructorReturnValue(CustomerRepositoryImpl.class.getConstructor(String.class), customerRepository);
assertThat(violations).containsOnlyViolations(violationOf(NotNull.class).withMessage(messagePrefix() + "must not be null").withInvalidValue(null).withRootBeanClass(CustomerRepositoryImpl.class).withPropertyPath(pathWith().constructor(CustomerRepositoryImpl.class).returnValue().property("customer")));
}
use of org.hibernate.validator.test.internal.engine.methodvalidation.service.CustomerRepositoryImpl in project hibernate-validator by hibernate.
the class AbstractConstructorValidationTest method constructorReturnValueValidationYieldsConstraintViolation.
@Test
public void constructorReturnValueValidationYieldsConstraintViolation() throws Exception {
CustomerRepositoryImpl customerRepository = new CustomerRepositoryImpl();
Set<ConstraintViolation<CustomerRepositoryImpl>> violations = executableValidator.validateConstructorReturnValue(CustomerRepositoryImpl.class.getConstructor(), customerRepository);
assertThat(violations).containsOnlyViolations(violationOf(ValidB2BRepository.class).withMessage(messagePrefix() + "{ValidB2BRepository.message}").withInvalidValue(customerRepository).withRootBeanClass(CustomerRepositoryImpl.class).withPropertyPath(pathWith().constructor(CustomerRepositoryImpl.class).returnValue()));
}
Aggregations