use of org.apache.wicket.mock.MockRequestParameters in project wicket by apache.
the class BaseWicketTester method serializeFormToRequest.
/**
* Puts all not already scheduled (e.g. via {@link FormTester#setValue(String, String)}) form
* component values in the post parameters for the next form submit
*
* @param form
* the {@link Form} which components should be submitted
*/
private void serializeFormToRequest(final Form<?> form) {
final MockRequestParameters postParameters = request.getPostParameters();
final Set<String> currentParameterNamesSet = postParameters.getParameterNames();
form.visitFormComponents(new IVisitor<FormComponent<?>, Void>() {
@Override
public void component(final FormComponent<?> formComponent, final IVisit<Void> visit) {
final String inputName = formComponent.getInputName();
if (!currentParameterNamesSet.contains(inputName)) {
String[] values = FormTester.getInputValue(formComponent);
for (String value : values) {
postParameters.addParameterValue(inputName, value);
}
}
}
});
}
Aggregations