On Tue, 17 Jul 2007, Ingram Chen wrote:
> We also suffer the same issues here. But due to unmanaged nature of Wicket,
> there is no chance to intercept construction of page B unless you build your
> own factory for page.
>
> class Page A {
> MyFactory myFactory ;
> public Page A {
> add(new Link("toBPage") {
> setResponsePage(myFactory.newBPage());
> });
> }
> }
I might do
class PageA extends Page {
public PageA() {
add(new Link("toBPage") {
@Override
public void onLinkClicked() {
goToPageB();
}
);
}
protected goToPageB() {
...
and overriding goToPageB() in the test.
This technique has even a fancy name in the excellent
_Working Effectively with Legacy Code_ by Michael Feathers,
so maybe it's a kludge to use it in non-legacy code. But
it's simple and it works.
- Timo
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user