Skip to content

Commit dc008e3

Browse files
authored
Move RabbitMQ tests to JUnit Jupiter (#10761)
1 parent d697dae commit dc008e3

File tree

3 files changed

+21
-33
lines changed

3 files changed

+21
-33
lines changed

modules/rabbitmq/build.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ description = "Testcontainers :: RabbitMQ"
22

33
dependencies {
44
api project(":testcontainers")
5+
6+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.11.0'
7+
8+
testImplementation 'org.junit.jupiter:junit-jupiter:5.13.4'
59
testImplementation 'com.rabbitmq:amqp-client:5.26.0'
610
testImplementation 'org.assertj:assertj-core:3.27.3'
711
compileOnly 'org.jetbrains:annotations:26.0.2'
@@ -12,3 +16,7 @@ tasks.japicmp {
1216
"org.testcontainers.containers.RabbitMQContainer"
1317
]
1418
}
19+
20+
test {
21+
useJUnitPlatform()
22+
}

modules/rabbitmq/src/test/java/org/testcontainers/containers/RabbitMQContainerJUnitIntegrationTest.java

Lines changed: 0 additions & 20 deletions
This file was deleted.

modules/rabbitmq/src/test/java/org/testcontainers/containers/RabbitMQContainerTest.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import com.rabbitmq.client.Connection;
77
import com.rabbitmq.client.ConnectionFactory;
88
import com.rabbitmq.client.DeliverCallback;
9-
import org.junit.Test;
9+
import org.junit.jupiter.api.Test;
1010
import org.testcontainers.containers.RabbitMQContainer.SslVerification;
1111
import org.testcontainers.utility.MountableFile;
1212

@@ -30,7 +30,7 @@
3030
import static org.assertj.core.api.Assertions.assertThat;
3131
import static org.assertj.core.api.Assertions.assertThatCode;
3232

33-
public class RabbitMQContainerTest {
33+
class RabbitMQContainerTest {
3434

3535
public static final int DEFAULT_AMQPS_PORT = 5671;
3636

@@ -41,7 +41,7 @@ public class RabbitMQContainerTest {
4141
public static final int DEFAULT_HTTP_PORT = 15672;
4242

4343
@Test
44-
public void shouldCreateRabbitMQContainer() {
44+
void shouldCreateRabbitMQContainer() {
4545
try (RabbitMQContainer container = new RabbitMQContainer(RabbitMQTestImages.RABBITMQ_IMAGE)) {
4646
container.start();
4747

@@ -70,7 +70,7 @@ public void shouldCreateRabbitMQContainer() {
7070
}
7171

7272
@Test
73-
public void shouldCreateRabbitMQContainerWithCustomCredentials() {
73+
void shouldCreateRabbitMQContainerWithCustomCredentials() {
7474
try (
7575
RabbitMQContainer container = new RabbitMQContainer(RabbitMQTestImages.RABBITMQ_IMAGE)
7676
.withAdminUser("admin")
@@ -86,7 +86,7 @@ public void shouldCreateRabbitMQContainerWithCustomCredentials() {
8686
}
8787

8888
@Test
89-
public void shouldCreateRabbitMQContainerWithExchange() throws IOException, InterruptedException {
89+
void shouldCreateRabbitMQContainerWithExchange() throws IOException, InterruptedException {
9090
try (RabbitMQContainer container = new RabbitMQContainer(RabbitMQTestImages.RABBITMQ_IMAGE)) {
9191
container.withExchange("test-exchange", "direct");
9292

@@ -98,7 +98,7 @@ public void shouldCreateRabbitMQContainerWithExchange() throws IOException, Inte
9898
}
9999

100100
@Test
101-
public void shouldCreateRabbitMQContainerWithExchangeInVhost() throws IOException, InterruptedException {
101+
void shouldCreateRabbitMQContainerWithExchangeInVhost() throws IOException, InterruptedException {
102102
try (RabbitMQContainer container = new RabbitMQContainer(RabbitMQTestImages.RABBITMQ_IMAGE)) {
103103
container.withVhost("test-vhost");
104104
container.withExchange(
@@ -119,7 +119,7 @@ public void shouldCreateRabbitMQContainerWithExchangeInVhost() throws IOExceptio
119119
}
120120

121121
@Test
122-
public void shouldCreateRabbitMQContainerWithQueues() throws IOException, InterruptedException {
122+
void shouldCreateRabbitMQContainerWithQueues() throws IOException, InterruptedException {
123123
try (RabbitMQContainer container = new RabbitMQContainer(RabbitMQTestImages.RABBITMQ_IMAGE)) {
124124
container
125125
.withQueue("queue-one")
@@ -135,7 +135,7 @@ public void shouldCreateRabbitMQContainerWithQueues() throws IOException, Interr
135135
}
136136

137137
@Test
138-
public void shouldMountConfigurationFile() {
138+
void shouldMountConfigurationFile() {
139139
try (RabbitMQContainer container = new RabbitMQContainer(RabbitMQTestImages.RABBITMQ_IMAGE)) {
140140
container.withRabbitMQConfig(MountableFile.forClasspathResource("/rabbitmq-custom.conf"));
141141
container.start();
@@ -145,7 +145,7 @@ public void shouldMountConfigurationFile() {
145145
}
146146

147147
@Test
148-
public void shouldMountConfigurationFileErlang() {
148+
void shouldMountConfigurationFileErlang() {
149149
try (RabbitMQContainer container = new RabbitMQContainer(RabbitMQTestImages.RABBITMQ_IMAGE)) {
150150
container.withRabbitMQConfigErlang(MountableFile.forClasspathResource("/rabbitmq-custom.config"));
151151
container.start();
@@ -155,7 +155,7 @@ public void shouldMountConfigurationFileErlang() {
155155
}
156156

157157
@Test
158-
public void shouldMountConfigurationFileSysctl() {
158+
void shouldMountConfigurationFileSysctl() {
159159
try (RabbitMQContainer container = new RabbitMQContainer(RabbitMQTestImages.RABBITMQ_IMAGE)) {
160160
container.withRabbitMQConfigSysctl(MountableFile.forClasspathResource("/rabbitmq-custom.conf"));
161161
container.start();
@@ -165,7 +165,7 @@ public void shouldMountConfigurationFileSysctl() {
165165
}
166166

167167
@Test
168-
public void shouldStartTheWholeEnchilada() throws IOException, InterruptedException {
168+
void shouldStartTheWholeEnchilada() throws IOException, InterruptedException {
169169
try (RabbitMQContainer container = new RabbitMQContainer(RabbitMQTestImages.RABBITMQ_IMAGE)) {
170170
container
171171
.withVhost("vhost1")
@@ -240,7 +240,7 @@ public void shouldStartTheWholeEnchilada() throws IOException, InterruptedExcept
240240
}
241241

242242
@Test
243-
public void shouldThrowExceptionForDodgyJson() {
243+
void shouldThrowExceptionForDodgyJson() {
244244
try (RabbitMQContainer container = new RabbitMQContainer(RabbitMQTestImages.RABBITMQ_IMAGE)) {
245245
assertThatCode(() -> container.withQueue("queue2", true, false, ImmutableMap.of("x-message-ttl", container))
246246
)
@@ -249,7 +249,7 @@ public void shouldThrowExceptionForDodgyJson() {
249249
}
250250

251251
@Test
252-
public void shouldWorkWithSSL() {
252+
void shouldWorkWithSSL() {
253253
try (RabbitMQContainer container = new RabbitMQContainer(RabbitMQTestImages.RABBITMQ_IMAGE)) {
254254
container.withSSL(
255255
MountableFile.forClasspathResource("/certs/server_key.pem", 0644),

0 commit comments

Comments
 (0)