I have 2 adjacent classes for my integration tests with the following signatures:
@ActiveProfiles("test")
public class AuthenticationTransformationTest extends AbstractKafkaIntegrationTest {
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
@ContextConfiguration(classes = {KafkaIntegrationConfig.class})
@RunWith(SpringRunner.class)
public abstract class AbstractKafkaIntegrationTest {
The idea is -- within this repo, we have N modules that utilize Spring. I'm looking to have a util
module that contains the Abstract class so others within their own modules can extend from it and run their tests. When moving the abstract class to another module, I have a bunch of errors getting the annotations to resolve, despite adding the required dependencies, etc.
What is the best, recommended way to have a util module that only provides the testing utility class? Do I need to throw an @Configuration annotation somewhere for this to be picked up correctly?
Edit: I've moved the classes to test dir - it helped resolve the annotation issue, but the dependency on the test util isn't resolving via Gradle:
.
├── moduleA
│ └── test
│ └── java
│ └── com
│ └── thing
│ └── integration
│ └── my-test.java
└── moduleB
└── test
└── java
└── com
└── thing
└── test-util.java
preamble of moduleA
plugins {
id "org.springframework.boot" version "$springBootVersion"
id "com.google.cloud.tools.jib" version "$jibVersion"
id "application"
id "java"
}
group "com.thing.test"
sourceCompatibility = JavaVersion.VERSION_11
dependencies {
testImplementation(testFixtures(project(':moduleB')))
I've tried just:
testImplementation(project(':moduleB'))
and get the same issue