Title: Message
Hmm, I thought there were a more "reliable" way, but this seems to work pretty well. I just created a MockValidatorContext that, unlike the DelegatingValidatorContext, doesn't need an Action to run. If it's interesting to you, just drop me a note and I'll document and test the code better, so I can send it to you :)
 
peace,
-cv
 
-----Mensagem original-----
De: Jason Carreira [mailto:[EMAIL PROTECTED]
Enviada em: terça-feira, 23 de setembro de 2003 15:27
Para: [EMAIL PROTECTED]
Assunto: RE: [OS-webwork] Testing validators?

Just create an instance of your FieldValidator and pass it a test object with a field of the correct name to validate... you'll need to set some values in like the field name and a ValidatorContext, which is just an error message container.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 23, 2003 1:26 PM
To: [EMAIL PROTECTED]
Subject: [OS-webwork] Testing validators?

Hi everyone! :)

I'm building some custom FieldValidators. If you want some mostly useless bit of culture, this is one that validates CPFs, one of the id's that every brazilian has to walk around with. This id is always numeric, and has some consistency check-digits at the end.

I'm pretty sure the logic behind the field validator is ok, but I'm not sure how to test it. I took at look at the sources, and there are mock configurations, but I couldn't really figure out what to do with them (Required*ValidatorTest don't show me much). Any hints?

peace,
-cv

Reply via email to