I've got an input field which accepts positive integers. I'm trying to test
the validation logic on my page but receiving the following error. Am I
misunderstanding how validation and type conversion work? In general I'm
having trouble with any fields that accept non-String input (Numbers, Dates,
etc).
public void testBadChangelistId() {
FormTester form = tester.newFormTester("theForm");
form.select("selectSubmissionDateType", 0);
form.select("status", 0);
form.setValue("fldChangeListID", "foo"); // <==== Invalid value
form.submit("btnSearch");
tester.assertInvisible("theForm:ifShowDateRange");
tester.assertRenderedPage(SearchChanges.class);
}
wicket.WicketRuntimeException: Exception 'java.lang.ClassCastException:
java.lang.String' occurred d
uring validation
wicket.markup.html.form.validation.NumberValidator$RangeValidator on
component 3:th
eForm:fldChangeListID
at
wicket.markup.html.form.FormComponent.validateValidators(FormComponent.java:1169)
at wicket.markup.html.form.Form$15.validate(Form.java:997)
at
wicket.markup.html.form.Form$ValidationVisitor.formComponent(Form.java:144)
at wicket.markup.html.form.Form$4.component(Form.java:459)
at
wicket.MarkupContainer.visitChildren(MarkupContainer.java(Compiled Code))
at wicket.markup.html.form.Form.visitFormComponents(Form.java:455)
at wicket.markup.html.form.Form.validateValidators(Form.java:993)
at wicket.markup.html.form.Form.validate(Form.java:955)
at wicket.markup.html.form.Form.process(Form.java:867)
at wicket.markup.html.form.Form.onFormSubmitted(Form.java:310)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compile
d Code))
at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
at
wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:163)
at
wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(Lis
tenerInterfaceRequestTarget.java:74)
at
wicket.request.compound.DefaultEventProcessorStrategy.processEvents(DefaultEventProcessor
Strategy.java:65)
at
wicket.request.compound.AbstractCompoundRequestCycleProcessor.processEvents(AbstractCompo
undRequestCycleProcessor.java:57)
at
wicket.RequestCycle.doProcessEventsAndRespond(RequestCycle.java:896)
at
wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:929)
at wicket.RequestCycle.step(RequestCycle.java:1010)
at wicket.RequestCycle.steps(RequestCycle.java:1084)
at wicket.RequestCycle.request(RequestCycle.java:454)
at
wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:318)
at
wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:307)
at wicket.util.tester.FormTester.submit(FormTester.java:141)
at wicket.util.tester.FormTester.submit(FormTester.java:180)
at
gov.TestSearchChanges.testBadChangelistId(TestSearchChanges.java:72)
Caused by: java.lang.ClassCastException: java.lang.String
at
wicket.markup.html.form.validation.NumberValidator.validate(NumberValidator.java:205)
at
wicket.markup.html.form.FormComponent.validateValidators(FormComponent.java:1155)
We are using 1.2.5.
mike
--
View this message in context:
http://www.nabble.com/FormTester-and-type-conversion-tf4014850.html#a11401713
Sent from the Wicket - User mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user