### Question:
SpringOvalValidator implements Validator, InitializingBean { @Override public void validate(final Object target, final Errors errors) { doValidate(target, errors, ""); } SpringOvalValidator(final net.sf.oval.Validator validator); @Override boolean supports(final Class<?> clazz); @Override void validate(final Object target, final Errors errors); @Override void afterPropertiesSet();  }### Answer:
@Test public void testValidate() throws Exception { final Errors errors = mock(Errors.class); final Container container = new Container(); final ConstraintViolation violation = mock(ConstraintViolation.class); final List<ConstraintViolation> violations = new ArrayList<ConstraintViolation>(); violations.add(violation); final FieldContext context = mock(FieldContext.class); final Field field = Container.class.getDeclaredField("innerObject"); when(context.getField()).thenReturn(field); when(violation.getContext()).thenReturn(context); when(ovalValidator.validate(any())).thenReturn(violations); testee.validate(container, errors); verify(ovalValidator).validate(container); verify(ovalValidator).validate(container.getInnerObject()); for (final InnerObject io : container.getInnerObjectList()) { verify(ovalValidator).validate(io); } for (final InnerObject io : container.getInnerObjectArray()) { verify(ovalValidator).validate(io); } verify(errors).rejectValue("innerObject", null, null); verify(errors).rejectValue("innerObject.innerObject", null, null); verify(errors).rejectValue("innerObjectList[0].innerObject", null, null); verify(errors).rejectValue("innerObjectList[1].innerObject", null, null); verify(errors).rejectValue("innerObjectArray[0].innerObject", null, null); verify(errors).rejectValue("innerObjectArray[1].innerObject", null, null); }