On Fri, 16 Nov 2007, Andy Barlow [Deftex] wrote:
> I guess what I really need to do mock off the getEJBService() of  
> MainApplication to return a "mock" object that serves the data to the  
> test pages.
> 
> Problem is, I'm not sure how to achieve that without initialising  
> WicketTester with a mock MainApplication, which will then fail with a  
> ClassCastException, as before.

WicketTester wicket = new WicketTester(new MainTestApplication());

...

public class MainTestApplication extends MainApplication {
...
    @Override public EjbService getEjbService() {
        return fakeEjbService;
    }
}

Though if you use EJB 3 I think that you could have
some kind of dependency injection instead of a service
locator.

Best wishes,
Timo

-- 
Timo Rantalaiho           
Reaktor Innovations Oy    <URL: http://www.ri.fi/ >

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to