[
https://issues.apache.org/jira/browse/WICKET-2015?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12663076#action_12663076
]
Juergen Donnerstag commented on WICKET-2015:
--------------------------------------------
Your latest quickstart prove my point. Your tests are wrong. Please see below
BTW, all tests are against 1.4 trunk.
TestFileUploadWithTextField.java
/**
* File is uploaded: Missing text field input is
* required as supposed to in form submit.
*/
public void testSubmit_FileUploaded_NoInput() {
formTester.setFile(fileUploadId, new File(testUploadFilePath),
"UTF-8");
formTester.submit();
tester.assertNoErrorMessage();
//assertEquals(1,
tester.getMessages(FeedbackMessage.ERROR).size());
}
You did not provide a value for the TextField which is setRequired(true). Since
you are not setting a value for TextValue, you receive an error message.
assertNoErrorMessage() == "assert that NO error message has been reported".
Wicket it right. Your test is wrong.
/**
* No File Uploaded: Text field is not required in
* submit as supposed to.
*/
public void testSubmit_NoFileUploaded_NoInput() {
formTester.submit();
tester.assertNoErrorMessage();
}
Same as above. No value for TextField with setRequired(true) => error message.
Wicket it right. Your test is wrong.
With HTML there is nothing such as a null value. Hence "" means empty. Hence
the following test reports an error
/**
* No File Uploaded: Text field is not required in
* submit as supposed to.
*/
public void testSubmit_NoFileUploaded_EmptyValues() {
formTester.setValue(textFieldId, "");
formTester.submit();
tester.assertNoErrorMessage();
}
Your test is wrong. No bug.
/**
* No file uploaded: Too short text field input
* validation malfunctions on form submit.
*/
public void testSubmit_NoFileUploaded_TooShortInput() {
formTester.setValue(textFieldId, textTooShortInput);
formTester.submit();
tester.assertNoErrorMessage();
}
You even wrote it in your comment. The value is too short, hence you expect an
error message. But that is not what you test. You are testing that there is no
error message. => No bug. Your test is wrong
The same, just that the text is too long. You expect an error, but your test is
about finding no error message.
/**
* No file uploaded: Too long text field input
* validation malfunctions on form submit.
*/
public void testSubmit_NoFileUploaded_TooLongInput() {
formTester.setValue(textFieldId, textTooLongInput);
formTester.submit();
tester.assertNoErrorMessage();
}
and so on and so on.
> 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,
> WicketQuickstart.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.