Hm... it seems to be related to the fact that I had forgotten
to have a contributeComponentClassResolver() in my PageTestModule
class. So now my copied MessagePage test works! Woohoo!

But I still get this exception for my real page:

   Request was not handled:
       'GamesLauncher' may not be a valid page name.

Need to read more on how contributeComponentClassResolver() works.

Mats

> Hi!
> 
> Yes, this did indeed get me further down the road. Thanks a lot!
> Now, when I run, I get a RunTimeException:
> 
> Request was not handled:
>    'MessagePage' may not be a valid page name.
>       at org.apache.tapestry5.test.PageTester.renderPage(PageTester.java:177)
> 
> I'm looking into this, but haven't found how to fix it yet.
> 
> Mats
> 
>> 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
>>
>>
> 
> 
> ---------------------------------------------------------------------
> 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

Reply via email to