最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Is it possible to mockdeactivate quarkus-discord4j for unit testing? - Stack Overflow

programmeradmin5浏览0评论

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.

发布评论

评论列表(0)

  1. 暂无评论