Hello, I wrote a custom validator for Dutch burger service numbers. However, whatever I try, I can't seem to be able to write a JUnit test for the onValidate method. An abstract of the code is included below.
I tried using EasyMock to mock the form component. However this is not possible because the error method I am calling from my validator is final. Any suggestions on how to test this thing? Regards, Erik. ------------------------8<------------------------------- public class SofiNummerValidator extends NumberValidator { public void onValidate(FormComponent formComponent, Number value) { if (value.longValue() < 10000000L) { error(formComponent, "SofiNummerValidator.TooSmall", messageModel(formComponent)); } int sum = ..some number magic..; if (sum != 0) { error(formComponent, "SofiNummerValidator.NotValid", messageModel(formComponent)); } } } ------------------------8<------------------------------- -- Erik van Oosten http://www.day-to-day-stuff.blogspot.com/ ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user