BeanValidatingItemProcessor extends ValidatingItemProcessor<T> { @Override public void afterPropertiesSet() throws Exception { SpringValidatorAdapter springValidatorAdapter = new SpringValidatorAdapter(this.validator); SpringValidator<T> springValidator = new SpringValidator<>(); springValidator.setValidator(springValidatorAdapter); springValidator.afterPropertiesSet(); setValidator(springValidator); super.afterPropertiesSet(); } BeanValidatingItemProcessor();  BeanValidatingItemProcessor(LocalValidatorFactoryBean localValidatorFactoryBean); @Override void afterPropertiesSet();  }
@Test public void testValidObjectValidation() throws Exception { BeanValidatingItemProcessor<Foo> validatingItemProcessor = new BeanValidatingItemProcessor<>(); validatingItemProcessor.afterPropertiesSet(); Foo foo = new Foo("foo"); Foo processed = validatingItemProcessor.process(foo); Assert.assertNotNull(processed); }
@Test(expected = ValidationException.class) public void testInvalidObjectValidation() throws Exception { BeanValidatingItemProcessor<Foo> validatingItemProcessor = new BeanValidatingItemProcessor<>(); validatingItemProcessor.afterPropertiesSet(); Foo foo = new Foo(""); validatingItemProcessor.process(foo); }