(I am reposting in a new thread since my reply to an old thread didn't give any feedback)
Hi!
I am trying to use Valang with annotations for server-side validation and want to write JUnit tests for it. But, I haven't been able to find any documentation on how to perform validation nor test the validation it and the source jar doesn't contain any test classes (at least not to my knowledge).
I thought I should be able to use code similar to the one seen below, but that obviously does not work. How do I implement server-side validation and, also, unit tests of the same?
Valang looks great, but if I am not able to resolve this soon I have to drop it. It has taken too much time already to get me started.
Please, give me some examples or, better yet, provide some examples on the web page (xml configuration and annotations configuration, client-side and server-side).
Kind Regards,
Jimisola
Regards,Code:public class SimpleBeanTest extends TestCase { public SimpleBeanTest(final String arg0) { super(arg0); } public void testValidation() { SimpleBean sb = new SimpleBean(); sb.setSimple(""); ValangValidator vv = new ValangValidator(); BindException errors = new BindException(sb, "target"); vv.validate(sb, errors); assertEquals("Validation should fail with one (1) errors since length < 1 (0)", 1, errors.getErrorCount()); } public class SimpleBean { @Length(min = 1, max = 255, message = "feature name must be between 1-255 characters") private String simple; public void setSimple(String simple) { this.simple = simple; } public String getSimple() { return this.simple; } } }
Jimisola


