### Question:
ParameterSpec implements Serializable { public PageParameters createParameters(T bean) { PageParameters params = new PageParameters(); for(String key : this.mapping.keySet()) { String expression = this.mapping.get(key); Object value = PropertyResolver.getValue(expression, bean); if(value != null) { params.set(key, value.toString()); } } return params; } ParameterSpec(Class <? extends WebPage> page, String... expressions); ParameterSpec registerParameter(String parameter, String propExpr); BookmarkablePageLink createLink(String id, final IModel<T> model); void redirect(IModel<T> model); PageParameters createParameters(T bean); void parseParameters(PageParameters params, T beanToPopulate); void parseParameters(PageParameters params,
                                T beanToPopulate,
                                boolean throw404OnParseError);  }### Answer:
@Test public void testCreateParameters_indexed() { TestBean bean = new TestBean(1L, "foo"); ParameterSpec builder = new ParameterSpec<TestBean>(TestPage.class, "id", "name"); PageParameters params = builder.createParameters(bean); Assert.assertEquals(bean.getId(), params.get("id").toLongObject()); Assert.assertEquals(bean.getName(), params.get("name").toString()); }