ValidationManager extends CustomValidatorBean { @SuppressWarnings("rawtypes") public Object convertRuleArgument(Object ruleArg, RuleExecutor executor) { Object convertedRuleArg = ruleArg; if (ruleArg != null) { Class<?> unwrappedExecutorClass = AopUtils.getTargetClass(executor); Class<?>[] parameterizedTypes = GenericTypeResolver.resolveTypeArguments(unwrappedExecutorClass, RuleExecutor.class); if (parameterizedTypes != null) { convertedRuleArg = getTypeConverter().convertIfNecessary(ruleArg, parameterizedTypes[1]); } } return convertedRuleArg; }  @Override boolean supports(Class<?> clazz); Errors validate(Object target); Errors validate(Object target, Object... validationHints); @Override void validate(Object target, Errors errors); @Override void validate(Object target, Errors errors, Object... validationHints); @SuppressWarnings("rawtypes") Object convertRuleArgument(Object ruleArg, RuleExecutor executor);  }
@Test public void testConvertNullRuleArgument() { Object converted = validationManager.convertRuleArgument(null, new MaxLengthRuleExecutor()); assertNull(converted); }
@Test public void testUnneccessaryConvertRuleArgument() { Object converted = validationManager.convertRuleArgument(5, new MaxLengthRuleExecutor()); assertEquals(5, converted); converted = validationManager.convertRuleArgument("5", new MatchesRuleExecutor()); assertEquals("5", converted); }
@Test public void testConvertRuleArgument() { Object converted = validationManager.convertRuleArgument("5", new MaxLengthRuleExecutor()); assertEquals(5, converted); }
@Test(expected=TypeMismatchException.class) public void testUnconvertibleRuleARgument() { validationManager.convertRuleArgument(new Customer(), new MaxLengthRuleExecutor()); }