I am building an application with Wicket and I am writing JUnit tests for my pages. My pages are in one package, which also contains a properties file called wicket-package.utf8.properties
. The properties are successfully loaded when I deploy the application on a server:
INFO org.apache.wicket.resource.PropertiesFactory - Loading properties files from file:/tmp/cargo/conf/webapps/my-project/WEB-INF/classes/com/myproject/web/wicket/page/wicket-package.utf8.properties with loader org.apache.wicket.resource.UtfPropertiesFilePropertiesLoader@37024e21
The problem appears, when I run the JUnit tests, because the PropertiesFactory loads a different properties file:
INFO org.apache.wicket.resource.PropertiesFactory - Loading properties files from jar:file:/home/lovro/.gradle/caches/modules-2/files-2.1/org.apache.wicket/wicket-core/6.16.0/85dd5611907b269f6a25569d9df45513bd0b1b5a/wicket-core-6.16.0.jar!/org/apache/wicket/Application.properties with loader org.apache.wicket.resource.IsoPropertiesFilePropertiesLoader@62e7f11d
What you can see is, that on the server a UtfPropertiesFilePropertiesLoader
is used, while in the tests a IsoPropertiesFilePropertiesLoader
is used for loading the properties.
How can I force the usage of my custom utf8 properties file in the JUnit tests?