This concept might work ok if the link only goes to the same page every time it is clicked, but what if the link goes to a different page depending on presentation logic with in the page. I think you would be SOL in that case.
-Craig Ingram Chen-2 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()); > }); > } > } > > and swapping mock MyFactory while testing. > > But such extra indirection make code slight complex and MyFactory is still > hard to test, either. > > > On 7/17/07, Craig Lenzen <[EMAIL PROTECTED]> wrote: >> >> >> I'm looking for some feedback as to an issue I'm having with the >> WicketTester. To start I'd like to point out that I'm using Spring and >> injecting my pages / components via the wicket spring project's component >> injector. >> >> Here is the situation, I have page A that has a link to page B. In the >> test >> of page A I test that the click in fact goes to page B. This is fine but >> the problem is, is that page B relies on a Spring service during its >> construction and the fact that the WicketTester actually tries to render >> page B which calls the service. The easy fix to this is to simply create >> a >> mock implementation of that service and set it in the mock context when >> testing page A, and don't forget you need to also setup the expected >> calls >> >> and returns. >> >> The problem here is that fact that I'm only testing page A, I don't care >> about the functionality of page B nor which services it might call. So >> is >> there a better way? Is there a way that you can mock the rendering of >> page >> B? Has anyone else ran into this issue and or questioned it, or has >> someone came up with a solution? >> >> To get a little more advanced you could also say that when testing a Page >> that added a number of panels I don't want those panels to render during >> the >> testing of the page, I only want to know the panels where added to the >> page. >> >> Thanks for everyone's help, >> Craig >> -- >> View this message in context: >> http://www.nabble.com/WicketTester-and-mocking-up-next-page-rendered.-tf4093923.html#a11641094 >> Sent from the Wicket - User mailing list archive at Nabble.com. >> >> >> ------------------------------------------------------------------------- >> 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 >> Wicket-user@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/wicket-user >> > > > > -- > Ingram Chen > online share order: http://dinbendon.net > blog: http://www.javaworld.com.tw/roller/page/ingramchen > > ------------------------------------------------------------------------- > 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 > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > -- View this message in context: http://www.nabble.com/WicketTester-and-mocking-up-next-page-rendered.-tf4093923.html#a11657439 Sent from the Wicket - User mailing list archive at Nabble.com. ------------------------------------------------------------------------- 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 Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user