I know that there are several questions on this .. but still I cannot make it work. I have a spring application for which I'm trying to write integration tests. I try to setup the application context using an xml file (more or less the same xml file that I'm using for the application). The problems that appeared are the following:
The configuration was not loaded and I've received errors like :"expected single bean but found 0."
I've specified the correct path and then it started to complain about resources that are not found on the classpath. I've copied the files that are missing inside the folder test/resources.
Now, it fails to load the application context with this error: No matching bean of type [javax.servlet.http.HttpServletRequest] found for dependency. (In my configuration file I have mvc:annotation-driven />)
I have followed this example http://www.scarba05.co.uk/blog/2010/07/more-on-integration-testing-of-spring%E2%80%99s-mvc-annotation-mapppings-for-controllers/ to make my integration test. Still, when I make the call handlerAdapter.handle(request, response, controller); I receive A ClassCastException because my controller is not an instance of a HandlerAdapter. I almost followed the same error path as the one found here: http://forum.springsource.org/showthread.php?131196-Spring-3-1-2-Controller-annotated-Controllers-JUnit-test-fail.
Yes, I am new to Spring, but at least I've searched and read a lot. Could you please point me to a good tutorial or to some sample projects (other than the spring ones) such that I can solve my problem.
Thank you in advance for the time that you spent on reading my question!