I'd like to write a unit (component) test for a REST resource of my web application. This test should target the exposed REST interface and test its behaviour by issuing requests and checking the responses.
The web application is configured without the use of web.xml
and applicationContext.xml
by making use of Spring's WebApplicationInitializer
. This works fine when I just run the application on my (Tomcat) server.
When starting my Arquillian test, the ShrinkWrap archive is deployed on the embedded Tomcat server. As the embedded server runs with the classpath of my web application, it also finds my WebApplicationInitializer
class. This is problematic, as it loads lots of dependencies, and should just be activated for the test.
How can I deactivate my WebApplicationInitializer
(and provide an alternative implementation) in the test?
When using XML configuration files this corresponds to hiding the real configuration files and using a specific (empty?) configuration which is used in the test.