These errors look pretty fine as is to me. The concepts of "empty" and "blank" (from StringUtils) both include the concept of null, so I would expect to see errors referring to empty/blank, and not null. The other cases are mostly to taste.
The "MSG" cases are correct too. Any message you supply overrides any message Validate uses by default. Stephen On 12 April 2011 20:21, Hoat Le <[email protected]> wrote: > /** > * Expected: java.lang.NullPointerException: The validated object is > null > * Actual: java.lang.NullPointerException: The validated array is > empty > */ > Validate.notEmpty((Object[]) null); > /** > * Expected: java.lang.NullPointerException: The validated object is > null > * Actual: java.lang.NullPointerException: MSG > */ > Validate.notEmpty((Object[]) null, "MSG"); > /** > * Expected: java.lang.NullPointerException: The validated object is > null > * Actual: java.lang.NullPointerException: The validated collection > is empty > */ > Validate.notEmpty((Collection<?>) null); > /** > * Expected: java.lang.NullPointerException: The validated object is > null > * Actual: java.lang.NullPointerException: MSG > */ > Validate.notEmpty((Collection<?>) null, "MSG"); > /** > * Expected: java.lang.NullPointerException: The validated object is > null > * Actual: java.lang.NullPointerException: The validated map is empty > */ > Validate.notEmpty((Map<?, ?>) null); > /** > * Expected: java.lang.NullPointerException: The validated object is > null > * Actual: java.lang.NullPointerException: MSG > */ > Validate.notEmpty((Map<?, ?>) null, "MSG"); > /** > * Expected: java.lang.NullPointerException: The validated object is > null > * Actual: java.lang.NullPointerException: The validated character > sequence is empty > */ > Validate.notEmpty((CharSequence) null); > /** > * Expected: java.lang.NullPointerException: The validated object is > null > * Actual: java.lang.NullPointerException: MSG > */ > Validate.notEmpty((CharSequence) null, "MSG"); > /** > * Expected: java.lang.NullPointerException: The validated object is > null > * Actual: java.lang.NullPointerException: The validated character > sequence is blank > */ > Validate.notBlank((CharSequence) null); > /** > * Expected: java.lang.NullPointerException: The validated object is > null > * Actual: java.lang.NullPointerException: MSG > */ > Validate.notBlank((CharSequence) null, "MSG"); > /** > * Ok: java.lang.NullPointerException: The validated object is null > */ > Validate.noNullElements((Object[]) null); > /** > * Ok: java.lang.NullPointerException: The validated object is null > */ > Validate.noNullElements((Object[]) null, "MSG"); > > Validate.validIndex(...); //=> ok will null > If you agree on the expected NullPointerException, please consider my > attached patch for this issue; there are duplicated code in *Validate* > class, and some unit test parts for *ValidateTest* are not relevant, too. > Thanks and best regards! > -- > Hoat Le [hoatle.net] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
