How do you organize tests in a modular Java project?

梦想与她 提交于 2019-11-28 09:21:33

Welcome to Testing In The Modular World!

Which kind of tests do you want write?

Black-box tests: Create a test-only project (no "src/main" directory) and declare a "src/test/java/module-info.java" module descriptor.

White-box tests: As it was from Day 1 you need to "blend in"/merge/shadow your test classes into your main classes or vice versa. Here you have mainly two ways to achieve this:

  • "compile modular main sources" and "patch plain test sources" at test-runtime with some additional "JVM options hacking the Module system" to execute tests.
  • "compile modular test sources" and "patch modular main sources" at compile-time to execute tests.

Blog

https://sormuras.github.io/blog/2018-09-11-testing-in-the-modular-world

Examples

Background and other resources

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!