Skip to content

Commit d1f807c

Browse files
committed
Testcontainers/Java: Adjust software tests for common base class use
The right choice is to use JUnit 5. https://testcontainers.com/guides/testcontainers-container-lifecycle/#_using_singleton_containers
1 parent 0b23823 commit d1f807c

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

testing/testcontainers/java/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ dependencies {
2525
implementation 'org.slf4j:slf4j-api:2.0.17'
2626
implementation 'org.slf4j:slf4j-simple:2.0.17'
2727
testImplementation 'junit:junit:4.13.2'
28+
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1'
2829
testImplementation "org.assertj:assertj-core:3.27.6"
2930
testImplementation 'org.testcontainers:testcontainers:2.0.1'
3031
testImplementation 'org.testcontainers:testcontainers-cratedb:2.0.1'

testing/testcontainers/java/src/test/java/io/crate/example/testing/TestClassScope.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
package io.crate.example.testing;
22

33
import io.crate.example.testing.utils.TestingHelpers;
4-
import org.junit.ClassRule;
5-
import org.junit.Test;
4+
import org.junit.jupiter.api.Test;
65
import org.testcontainers.cratedb.CrateDBContainer;
76

87
import java.io.IOException;
@@ -25,7 +24,6 @@
2524
*/
2625
public class TestClassScope {
2726

28-
@ClassRule
2927
public static CrateDBContainer cratedb = new CrateDBContainer(TestingHelpers.nameFromLabel("5.10"));
3028

3129
@Test

testing/testcontainers/java/src/test/java/io/crate/example/testing/TestFunctionScope.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
package io.crate.example.testing;
22

33
import io.crate.example.testing.utils.TestingHelpers;
4-
import org.junit.Rule;
5-
import org.junit.Test;
4+
import org.junit.jupiter.api.Test;
65
import org.testcontainers.cratedb.CrateDBContainer;
76

87
import java.io.IOException;
@@ -25,7 +24,6 @@
2524
*/
2625
public class TestFunctionScope {
2726

28-
@Rule
2927
public CrateDBContainer cratedb = new CrateDBContainer(TestingHelpers.nameFromLabel("5.10"));
3028

3129
@Test

0 commit comments

Comments
 (0)