Hi Mats, Yes, this is a question that has come up before, Paul provided the answer... you can do a google for the original post, but you will need to create a module with a contribution that ensures there are replacement HTTP request/response objects available for your tests, then use a mock to replace the request and response in your actual test.
This is the code Paul provided: public static void contributeRequestHandler(OrderedConfiguration<RequestFilter> config, final RequestGlobals requestGlobals) { RequestFilter filter = new RequestFilter() { public boolean service(Request request, Response response, RequestHandler handler) throws IOException { requestGlobals.storeServletRequestResponse(mock (HttpServletRequest.class), mock(HttpServletResponse.class)); return handler.service(request, response); } }; config.add("EnsureNonNullHttpRequestAndResponse", filter, "before:*"); } Kind regards, Peter ----- Original Message ----- From: "Mats Henricson" <m...@henricson.se> To: "Tapestry users" <users@tapestry.apache.org> Sent: Thursday, 3 September, 2009 16:30:10 GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: Re: Can't get Testify & JUnit 4 & Mockito working >> My current guess is that @ForComponents is pulling in and handling >> binding from my real AppManager, even though it is in no way part >> of the test. > > In that case try creating the TapestryTester with a nonsense app name: > > private static final TapestryTester SHARED_TESTER > = new TapestryTester("nonsense", MyModule.class); > > That will make sure Tapestry/Testify are using only the modules you > specify in the constructor. This seems to do the trick, actually! Much much thanks! But now Acegi Security is kicking in, and I get: Can only process HttpServletRequest Has anyone managed to mock it out of the picture? Mats --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org