Hello, It is almost impossible to get anyone attention on struts-user. I'm using Struts and Validator with it. I wrote a custom Validator and want to write a unit test for it. My Validator has a method like this:
public static boolean validateStartLetter( Object bean, ValidatorAction validatorAction, Field field, ActionErrors errors, HttpServletRequest request ) { String value = ValidatorUtil.getValueAsString(bean, field.getProperty()); if ((GenericValidator.isBlankOrNull(value)) || !Character.isLetter(value.charAt(0))) { errors.add(field.getKey(), Resources.getActionError(request, validatorAction, field)); } return errors.isEmpty(); } I am running JUnit from Ant to run my unit test class. Apparently this doesn't work because the instance of ActionErrors passed to this method is null, causing a NPE. I wanted to check the unit tests for Validator in Struts (FieldChecks) to see how you wrote your unit tests, so that this NPE is avoided, but I could not find any unit tests for it. Are there really no unit tests there? Regardless, how would you go about running unit tests for a custom validator from something like Ant? It seems to me that doing that may be impossible, because there is no Struts running to instantiate ActionErrors, there is no HttpServletRequest, and so on. Is there a way to do this? Thanks, Otis ________________________________________________ Get your own "800" number Voicemail, fax, email, and a lot more http://www.ureach.com/reg/tag --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]