Is it possible to mock/disable/bypass Discord4j when running @QuarkusTest
in an application using Quarkus Discord4j?
I'm using Quarkus Discord4j to benefit from the great integration work the authors made, but I'm having an issue when unit testing my application: @QuarkusTest
is connecting to Discord4j, using my live token (in my .env
file). This comes with a series of problems:
- My tests could mess up with a live environment (I could create a second Discord test app with a dedicated token, but that's only part of the issue).
- I can't test offline (or on computers with firewall/websocket restrictions).
- Starting Discord4j seems to slow down my tests.
So Discord4j is messing with my unit tests while I'm not testing Discord4j-related features. I also need some Quarkus tooling because I'm trying to test things that I cannot/don't know how to set up without @QuarkusTest
.
I'd love to be able to say "hey, I'm testing, so here's the mock Discord4j to use/I don't need Discord4j at all."
Thanks for any pointer.