-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
QuarkusComponentTest: offer a convenient way of mocking interceptors #34086
Comments
A few alternative options, not saying any of them is better, just something that crossed my mind.
The reason why I'm so keen on enabling something like the first example is because it's closest to what you'd naturally write, and I think that's desirable. |
Except that we don't. And IIRC it was changed based on a user request 🤷. Another disadvantage of this approach is that you can't test multiple sorted interceptors...
This could work but (1) it's another new annotation and (2) I don't see a big benefit in declaring a dedicated class for each interceptor... |
You're right but it could be even more confusing, i.e. you can't use exactly the same code so it may happen that you forget to replace one annotation with another... @Ladicek One thing we could do is to register all static nested interceptor classes declared on a |
I actually thought making all classes nested in the test class part of the system under test would be really nice.
|
Description
Currently, if an interceptor binding is declared in a tested component and we would like to reflect the binding in the test, then an mock interceptor class must be registered as an additional component, e.g. something like:
Moreover, this interceptor class may cause problems in regular
@QuarkusTest
s, because all classes insrc/test/java
are discovered by default. So the %test.quarkus.arc.exclude-types config property would need to be used in order to exclude the interceptor class from discovery.Implementation ideas
I was thinking that we could support "interceptor methods" declared direcly on the test class.
That would of course require support of synthetic interceptors in ArC (not supported at the moment)
The text was updated successfully, but these errors were encountered: