FilippoDiotalevi wrote:
>
> Hi,
> my application is in the (usual, I think) situation where the messages
> for the page (i.e.) ContactMePage are partly contained in the
> ContactMePage.properties file, and partly in the global
> MyWebApplication.properties file.
>
> In this situation, when I use WicketTester to test the ContactMePage I
> see a lot of INFO log like:
>
> WicketMessageResolver - No value found for message key: contact.email
>
> because the MockWebApplication cannot resolve messages belonging to
> the global property file.
> Is there a way to make WicketTester aware of the existence of global
> message bundles?
>
> (And a more general question) how do you test that all wicket:messages
> are rendered correctly?
>
To use application properties I extend WicketTester and have this in
constructor:
CompoundResourceStreamLocator locator = (
CompoundResourceStreamLocator
)getResourceSettings().getResourceStreamLocator();
locator.add( 0, new AbstractResourceStreamLocator()
{
protected IResourceStream locate( final Class clazz, final
String path )
{
String testPropertiesFile = MyTester.class.getSimpleName() +
".properties";
String realPropertiesFile =
MyApplication.class.getSimpleName() + ".properties";
if( path.contains( testPropertiesFile ) )
{
String substitutedPath = path.replace(
testPropertiesFile, realPropertiesFile );
return new ClassLoaderResourceStreamLocator().locate(
MyApplication.class, substitutedPath );
}
return null;
}
} );
I test wicket:messages simply with WicketTester#assertLabel(...)
--
View this message in context:
http://www.nabble.com/WicketTester-message-resolution-tf3360811.html#a9349318
Sent from the Wicket - User mailing list archive at Nabble.com.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user