Skip to content

Commit e78c5e2

Browse files
committed
Move jdbc-test tests to JUnit Jupiter
1 parent a70dbdd commit e78c5e2

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

modules/jdbc-test/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ dependencies {
1111
api 'org.apache.tomcat:tomcat-jdbc:11.0.10'
1212
api 'org.vibur:vibur-dbcp:26.0'
1313
api 'mysql:mysql-connector-java:8.0.33'
14+
api 'org.junit.jupiter:junit-jupiter:5.13.4'
1415
}

modules/jdbc-test/src/main/java/org/testcontainers/jdbc/AbstractJDBCDriverTest.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
import com.zaxxer.hikari.HikariDataSource;
55
import org.apache.commons.dbutils.QueryRunner;
66
import org.apache.commons.lang3.SystemUtils;
7-
import org.junit.AfterClass;
8-
import org.junit.Test;
9-
import org.junit.runners.Parameterized.Parameter;
7+
import org.junit.jupiter.api.AfterAll;
8+
import org.junit.jupiter.api.Test;
9+
import org.junit.jupiter.params.Parameter;
10+
import org.junit.jupiter.params.ParameterizedClass;
11+
import org.junit.jupiter.params.provider.MethodSource;
1012

1113
import java.sql.Connection;
1214
import java.sql.ResultSet;
@@ -17,6 +19,8 @@
1719
import static org.assertj.core.api.Assertions.assertThat;
1820
import static org.junit.Assume.assumeFalse;
1921

22+
@ParameterizedClass
23+
@MethodSource("data")
2024
public class AbstractJDBCDriverTest {
2125

2226
protected enum Options {
@@ -27,7 +31,7 @@ protected enum Options {
2731
PmdKnownBroken,
2832
}
2933

30-
@Parameter
34+
@Parameter(0)
3135
public String jdbcUrl;
3236

3337
@Parameter(1)
@@ -39,13 +43,13 @@ public static void sampleInitFunction(Connection connection) throws SQLException
3943
connection.createStatement().execute("CREATE TABLE my_counter (\n" + " n INT\n" + ");");
4044
}
4145

42-
@AfterClass
46+
@AfterAll
4347
public static void testCleanup() {
4448
ContainerDatabaseDriver.killContainers();
4549
}
4650

4751
@Test
48-
public void test() throws SQLException {
52+
void test() throws SQLException {
4953
try (HikariDataSource dataSource = getDataSource(jdbcUrl, 1)) {
5054
performSimpleTest(dataSource);
5155

0 commit comments

Comments
 (0)