use of org.apache.wicket.request.IWritableRequestParameters in project wicket by apache.
the class AjaxEditableTest method testModelObjectClassInference.
/**
* <a href="https://issues.apache.org/jira/browse/WICKET-4259">WICKET-4259</a>
*/
@Test
public void testModelObjectClassInference() {
class IntegerModel extends Model<Integer> implements IObjectClassAwareModel<Integer> {
@Override
public Class<Integer> getObjectClass() {
return Integer.class;
}
}
IModel<Integer> integerModel = new IntegerModel();
AjaxEditableLabel<Integer> editableLabel = new AjaxEditableLabel<Integer>("test", integerModel);
editableLabel.getEditor().setVisible(true);
IWritableRequestParameters postParameters = (IWritableRequestParameters) tester.getRequestCycle().getRequest().getPostParameters();
postParameters.setParameterValues(editableLabel.getEditor().getInputName(), Arrays.asList(new StringValue[] { StringValue.valueOf("5") }));
editableLabel.getEditor().processInput();
assertThat(integerModel.getObject(), instanceOf(Integer.class));
}
Aggregations