Thanks for @prasadu 's answer:
There is ability with testFixtures
:
https://docs.gradle.org/current/userguide/java_testing.html#sec:java_test_fixtures
If you use them with *api
like in core
module:
testFixturesCompileOnlyApi 'asdf:qwer:zxcv'
testFixturesApi 'org.springframework.boot:spring-boot-starter-test'
testFixturesRuntimeOnly 'org.junit.platform:junit-platform-launcher'
And then if you use
core module in other modules like:
implementation project(':core')
testImplementation testFixtures(project(':core'))
You can automatically use that tests.
Don't forget to use with:
plugins {
id 'java-library'
id 'java-test-fixtures'
}