Reputation: 1903
I have an old project that needed to be connected to ActiveMQ Artemis. Then I decided to write an integration test. However, I get an error at startup.
I use Spring 2.5.14 and build.gradle
.
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.artifactory'
apply from: 'confluence.gradle'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
....
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-artemis'
implementation "org.messaginghub:pooled-jms:$jmsPoolConnectionVersion"
implementation 'org.springframework.boot:spring-boot-starter-validation'
.....
testImplementation 'junit:junit:4.12'
testImplementation "org.testcontainers:activemq:1.19.5"
testImplementation 'org.apache.activemq:artemis-junit-5:2.32.0'
testImplementation 'org.testcontainers:junit-jupiter:1.19.5'
}
@ExtendWith(SpringExtension.class)
@SpringBootTest
class ContainerConfig {
ArtemisContainer artemis = new ArtemisContainer("apache/activemq-artemis:2.30.0-alpine")
.withUser("testcontainers")
.withPassword("testcontainers");
@Test
public void test(){
Assertions.assertTrue(true);
}
@ExtendWith(SpringExtension.class)
@SpringBootTest
public class ContainerConfig {
public static final GenericContainer<?> artemisContainer;
static {
DockerImageName postgres = DockerImageName.parse("apache/activemq-artemis:latest-alpine");
artemisContainer = new GenericContainer<>(
DockerImageName.parse("apache/activemq-artemis:latest-alpine"))
.withEnv("ANONYMOUS_LOGIN", "true")
.withExposedPorts(61616);
artemisContainer.start();
}
However, this error occurs:
error: cannot access org.junit.rules.TestRule
.withUser("testcontainers")
^
class file for org.junit.rules.TestRule not found
org.springframework.boot:spring-boot-starter-test -> 2.5.14
| +--- org.springframework.boot:spring-boot-starter:2.5.14 (*)
| +--- org.springframework.boot:spring-boot-test:2.5.14
| | \--- org.springframework.boot:spring-boot:2.5.14 (*)
| +--- org.springframework.boot:spring-boot-test-autoconfigure:2.5.14
......
+--- org.junit.jupiter:junit-jupiter:5.7.2
| | +--- org.junit:junit-bom:5.7.2
| | | +--- org.junit.jupiter:junit-jupiter:5.7.2 (c)
| | | +--- org.junit.jupiter:junit-jupiter-api:5.7.2 (c)
| | | +--- org.junit.jupiter:junit-jupiter-engine:5.7.2 (c)
| | | +--- org.junit.jupiter:junit-jupiter-params:5.7.2 (c)
| | | +--- org.junit.platform:junit-platform-commons:1.7.2 (c)
| | | \--- org.junit.platform:junit-platform-engine:1.7.2 (c)
| | +--- org.junit.jupiter:junit-jupiter-api:5.7.2
| | | +--- org.junit:junit-bom:5.7.2 (*)
| | | +--- org.apiguardian:apiguardian-api:1.1.0
| | | +--- org.opentest4j:opentest4j:1.2.0
| | | \--- org.junit.platform:junit-platform-commons:1.7.2
| | | +--- org.junit:junit-bom:5.7.2 (*)
| | | \--- org.apiguardian:apiguardian-api:1.1.0
| | +--- org.junit.jupiter:junit-jupiter-params:5.7.2
| | | +--- org.junit:junit-bom:5.7.2 (*)
| | | +--- org.apiguardian:apiguardian-api:1.1.0
| | | \--- org.junit.jupiter:junit-jupiter-api:5.7.2 (*)
Do you have any ideas how to fix this?
Upvotes: 1
Views: 1171