### Question:
ParameterSpec implements Serializable { public BookmarkablePageLink createLink(String id, final IModel<T> model) { BookmarkablePageLink bpl = new BookmarkablePageLink(id, this.pageClass) { @Override protected void onBeforeRender() { PageParameters params = createParameters(model.getObject()); for(PageParameters.NamedPair pair : params.getAllNamed()) { getPageParameters().set(pair.getKey(), pair.getValue()); } super.onBeforeRender(); } @Override protected void onDetach() { model.detach(); super.onDetach(); } }; return bpl; } 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 testCreateLink_indexed() { TestBean bean = new TestBean(1L, "foo"); ParameterSpec builder = new ParameterSpec<TestBean>(TestPage.class, "id", "name"); BookmarkablePageLink link = builder.createLink("bar", new Model(bean)); this.tester.startComponent(link); Assert.assertEquals("bar", link.getId()); Assert.assertEquals(TestPage.class, link.getPageClass()); PageParameters params = link.getPageParameters(); Assert.assertEquals(bean.getId(), params.get("id").toLongObject()); Assert.assertEquals(bean.getName(), params.get("name").toString()); }