The fact that your handler interceptor isn't invoked might be because
when testing, you're not actually going through Spring's
SimpleHandlerMapping and DispatcherServlet.

With Spring 2.0, you could probably use the new AOP stuff and an
AspectJ pointcut expression to intercept before a Controller's methods
execute.

Matt

On 12/18/06, Jon Loken <[EMAIL PROTECTED]> wrote:
Hi all,

I am wondering if anyone can enlighten me regarding /test/web
mocktests....

Previously I successfully AOP adviced a method (using
MethodBeforeAdvice). Method
'before(Method method, Object[] args, Object target)'
was called, BOTH during mocktests AS WELL AS on tomcat.

However, since it is a bit messy configuring the advice, I replaced the
advice with a request interceptor , subclassing
HandlerInterceptorAdapter, which seems a cleaner approach.

Despite the interceptor kicking in as expected on tomcat, this does not
seem to be the case in the mockweb tests. As a result, my mock tests,
which assumed the 'aspect code' to be run, fail.

This does puzzle me since action-servlet.xml with all the bean
definitions is picked up in BaseControllerTestCase.java regardless which
approach I use.



As I already separately test the interceptor/aspect, I really can
remove/alter the controller tests that assume the orthogonal code is
run. Still.... I would like to know why the interceptor is not executed
in the tests.

Any help appreciated.


Thanks,
Jon


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information visit http://www.virtual-email.net/messagelabs.htm

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
http://raibledesigns.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to