-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interceptor tests do not correctly register Interceptor in applicationContext #29
Comments
I have the same issue. This can also be seen in this test project: https://github.com/sbglasius/grailsInterceptorBugs
|
I am somewhat surprised because this is pretty subtle and still present (Grails 4.0.1) and has taken me one full day of trials to understand why even the most simple test wouldn't call the interceptor before() logic. |
When writing an Interceptor test, the first test does not actually call the before method in the interceptor at all even if you have a matchAll() in the constructor.
All subsequent tests after the first appear to work fine. It's only the first one that doesn't work. It seems that the bean isn't correctly registered in the application context and the call to:
applicationContext.getBeansOfType(Interceptor).values() as Interceptor[]
in the mockInterceptor method of InterceptorUnitTest returns an empty list.I've attached a test project showing the behavior.
InterceptorTestBug.zip
The text was updated successfully, but these errors were encountered: