/** * Set component's value into request parameter, this method overwrites existing parameters. * * @param component * an {@link IFormSubmittingComponent} * @param value * a value to add */ private void setFormSubmittingComponentValue(IFormSubmittingComponent component, String value) { tester.getRequest().getPostParameters().setParameterValue(component.getInputName(), value); }
/** * Set component's value into request parameter, this method overwrites existing parameters. * * @param component * an {@link IFormSubmittingComponent} * @param value * a value to add */ private void setFormSubmittingComponentValue(IFormSubmittingComponent component, String value) { tester.getRequest().getPostParameters().setParameterValue(component.getInputName(), value); }
/** * Returns <code>true</code> if the parameter exists in the <code>FormComponent</code>. * * @param formComponent * a <code>FormComponent</code> * @return <code>true</code> if the parameter exists in the <code>FormComponent</code> */ private boolean parameterExist(final FormComponent<?> formComponent) { String parameter = tester.getRequest() .getPostParameters() .getParameterValue(formComponent.getInputName()) .toString(); return parameter != null && parameter.trim().length() > 0; }
/** * Returns <code>true</code> if the parameter exists in the <code>FormComponent</code>. * * @param formComponent * a <code>FormComponent</code> * @return <code>true</code> if the parameter exists in the <code>FormComponent</code> */ private boolean parameterExist(final FormComponent<?> formComponent) { String parameter = tester.getRequest() .getPostParameters() .getParameterValue(formComponent.getInputName()) .toString(); return parameter != null && parameter.trim().length() > 0; }
/** * 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); } } } }); }
/** * 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); } } } }); }
/** * Set formComponent's value into request parameter, this method overwrites existing parameters. * * @param formComponent * a <code>FormComponent</code> * @param value * a value to add */ private void setFormComponentValue(final FormComponent<?> formComponent, final String value) { tester.getRequest() .getPostParameters() .setParameterValue(formComponent.getInputName(), value); }
/** * Set formComponent's value into request parameter, this method overwrites existing parameters. * * @param formComponent * a <code>FormComponent</code> * @param value * a value to add */ private void setFormComponentValue(final FormComponent<?> formComponent, final String value) { tester.getRequest() .getPostParameters() .setParameterValue(formComponent.getInputName(), value); }
.getPostParameters() .getParameterValues(formComponent.getInputName()); .getPostParameters() .setParameterValues(formComponent.getInputName(), values);
.getPostParameters() .getParameterValues(formComponent.getInputName()); .getPostParameters() .setParameterValues(formComponent.getInputName(), values);
if (!request.getPostParameters().getParameterNames().contains(name)) request.getPostParameters().setParameterValue(name, "marked");
if (!request.getPostParameters().getParameterNames().contains(name)) request.getPostParameters().setParameterValue(name, "marked");
request.getPostParameters().setParameterValue(pageRelativePath, "x"); request.getPostParameters().setParameterValue(pageRelativePath, "x");
request.getPostParameters().setParameterValue(pageRelativePath, "x"); request.getPostParameters().setParameterValue(pageRelativePath, "x");
username, tester.getLastRequest() .getPostParameters() .getParameterValue("username") .toString()); password, tester.getLastRequest() .getPostParameters() .getParameterValue("password") .toString());