You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Marco Aurélio Silva <ma...@gmail.com> on 2008/02/01 19:16:16 UTC
How to load application resource properties on Junit test
Hi all
I'm writing some test cases for my wicket application, and I got the
follow exception:
Caused by: java.util.MissingResourceException: Unable to find
resource: home for component:
pathway:repeater:i_want_to:stepLink:stepColor
at wicket.Localizer.getString(Localizer.java:262)
at wicket.Localizer.getString(Localizer.java:181)
at wicket.model.ResourceModel.getObject(ResourceModel.java:69)
at wicket.Component.getModelObject(Component.java:983)
at wicket.Component.getModelObjectAsString(Component.java:998)
at wicket.markup.html.basic.Label.onComponentTagBody(Label.java:113)
at wicket.Component.renderComponent(Component.java:1712)
... 67 more
The problem is this resource key "home" is located at the global
resource file MyApplication.properties, and in this test case I'm
testing a simple Page. After a lot debug, I noticed that the problem
is only when I try to get a resource in code, using ResourceModel or
StringResourceModel (I mean, the tag <wicket:message key="home"> in
HTML works fine). In Junit test, these models can't find the key in
the global resource file. If I put the key in the property file of my
Page, it works. By the way, the code works fine on application
running on web container, just in Junit test it fails. I'm using
wicket 1.2.6. Any help is welcome!
Thank you
Marco
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org