[
https://issues.apache.org/jira/browse/WICKET-2015?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12667208#action_12667208
]
Carsten Behring commented on WICKET-2015:
-----------------------------------------
There is somehow a problem with the tester and file upload.
I use wicket 1.3.4 (but it's the same with 1.3.5)
I have the following test code, which works perfectly:
FormTester
mandateFormTester=tester.newFormTester("mandateForm");
mandateFormTester.setFile("newdocContainer:fileName", new
org.apache.wicket.util.file.File(file), "text/plain");
mandateFormTester.setValue("mandateNumber", "123");
mandateFormTester.submit("saveBtn");
tester.assertNoErrorMessage();
tester.assertInfoMessageStartsWith("Mandate saved:");
If I remove the "mandateFormTester.setFile" (which is marked as "required") I
do NOT get an validation error, as I would except. Instead the test fails on
the last line, so there is no info message, which means for my code that the
form did not get submitted.
In a previous version of my code the fileupload was not required, but I had the
same problem.
Without call tester.setFile() it seems to not submit the form. As I said in my
previous comment, I found with the debugger an non-catched exception in class
MultiPartFormInputStream, method "skipPreamble".
I will try now with 1.4-RC1 and let you know.
> Empty File Upload field breaks validation of other fields in WicketTester.
> --------------------------------------------------------------------------
>
> Key: WICKET-2015
> URL: https://issues.apache.org/jira/browse/WICKET-2015
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.4-RC1
> Environment: Windows XP SP3, Eclipse IDE, Wicket 1.4-rc1.
> Reporter: Kari Maja
> Attachments: Wicket-Quickstart-Update.zip, Wicket-Quickstart.zip
>
>
> Submitting form with empty FileUpload -field break validations of other
> fields in WicketTester:
> - TextField mandatority (field.setRequired(true)).
> - TextField input length validation
> (field.add(StringValidator(lengthBetween(...)))).
> - DropDownChoice validation does not "see" selection.
> If File Upload -field is filled, then validations above work.
> Form submits manually without a problem in web browser.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.