The last few days i’ve tried to find a bug in a bean that had session scope, so I attempted to do some integration testing with the new bean scopes. I’ve searched the spring forums, but I found no convenient way to do this.
Then I had a look at the RequestContextFilterTests (RequestContextFilter or RequestContextListener is needed for doing these new scope things). I thought there should be a way to get some integration testing with the filter. And it seems to work nicely!
Now lets look at the code – here (the code display of wordpress is not very nice)!
With this testcase I can now really do integration testing with the new scopes introduced in spring 2.0. I simply put my application context configs with the scoped beans into my test and implement the doFilter method of the filter chain.
For example – here.
I would like to know what you spring guys out there think about it! Please drop me a line!