Skip to content

Commit 995d278

Browse files
committed
Fix missing junit4 leftovers
1 parent 2d15014 commit 995d278

File tree

5 files changed

+18
-32
lines changed

5 files changed

+18
-32
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import java.util.EnumSet;
1818

1919
import static org.assertj.core.api.Assertions.assertThat;
20-
import static org.junit.Assume.assumeFalse;
20+
import static org.assertj.core.api.Assumptions.assumeThat;
2121

2222
@ParameterizedClass
2323
@MethodSource("data")
@@ -207,7 +207,7 @@ private HikariDataSource verifyCharacterSet(String jdbcUrl) throws SQLException
207207
}
208208

209209
private void performTestForCustomIniFile(HikariDataSource dataSource) throws SQLException {
210-
assumeFalse(SystemUtils.IS_OS_WINDOWS);
210+
assumeThat(SystemUtils.IS_OS_WINDOWS).isFalse();
211211
Statement statement = dataSource.getConnection().createStatement();
212212
statement.execute("SELECT @@GLOBAL.innodb_max_undo_log_size");
213213
ResultSet resultSet = statement.getResultSet();

modules/junit-jupiter/src/test/java/org/testcontainers/junit/jupiter/TestLifecycleAwareExceptionCapturingTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package org.testcontainers.junit.jupiter;
22

3-
import org.junit.AssumptionViolatedException;
43
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
54
import org.junit.jupiter.api.Order;
65
import org.junit.jupiter.api.Test;
76
import org.junit.jupiter.api.TestMethodOrder;
7+
import org.opentest4j.TestAbortedException;
88

99
import static org.assertj.core.api.Assertions.assertThat;
10-
import static org.junit.Assume.assumeTrue;
10+
import static org.assertj.core.api.Assumptions.assumeThat;
1111

1212
// The order of @ExtendsWith and @Testcontainers is crucial in order for the tests
1313
@Testcontainers
@@ -24,14 +24,14 @@ class TestLifecycleAwareExceptionCapturingTest {
2424
void failing_test_should_pass_throwable_to_testContainer() {
2525
startedTestContainer = testContainer;
2626
// Force an exception that is captured by the test container without failing the test itself
27-
assumeTrue(false);
27+
assumeThat(false).isTrue();
2828
}
2929

3030
@Test
3131
@Order(2)
3232
void should_have_captured_thrownException() {
3333
Throwable capturedThrowable = startedTestContainer.getCapturedThrowable();
34-
assertThat(capturedThrowable).isInstanceOf(AssumptionViolatedException.class);
35-
assertThat(capturedThrowable.getMessage()).isEqualTo("got: <false>, expected: is <true>");
34+
assertThat(capturedThrowable).isInstanceOf(TestAbortedException.class);
35+
assertThat(capturedThrowable.getMessage()).contains("Expecting value to be true but was false");
3636
}
3737
}

modules/mariadb/src/test/java/org/testcontainers/junit/mariadb/SimpleMariaDBTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import static org.assertj.core.api.Assertions.assertThat;
2121
import static org.assertj.core.api.Assumptions.assumeThat;
22-
import static org.junit.Assume.assumeFalse;
2322

2423
class SimpleMariaDBTest extends AbstractContainerDatabaseTest {
2524

@@ -58,7 +57,7 @@ void testSpecificVersion() throws SQLException {
5857

5958
@Test
6059
void testMariaDBWithCustomIniFile() throws SQLException {
61-
assumeFalse(SystemUtils.IS_OS_WINDOWS);
60+
assumeThat(SystemUtils.IS_OS_WINDOWS).isFalse();
6261

6362
try (
6463
MariaDBContainer<?> mariadbCustomConfig = new MariaDBContainer<>(

modules/selenium/src/main/java/org/testcontainers/containers/RecordingFileFactory.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,10 @@
11
package org.testcontainers.containers;
22

3-
import org.junit.runner.Description;
43
import org.testcontainers.containers.VncRecordingContainer.VncRecordingFormat;
54

65
import java.io.File;
76

87
public interface RecordingFileFactory {
9-
@Deprecated
10-
default File recordingFileForTest(File vncRecordingDirectory, Description description, boolean succeeded) {
11-
return recordingFileForTest(
12-
vncRecordingDirectory,
13-
description.getTestClass().getSimpleName() + "-" + description.getMethodName(),
14-
succeeded
15-
);
16-
}
17-
188
default File recordingFileForTest(
199
File vncRecordingDirectory,
2010
String prefix,

modules/selenium/src/test/java/org/testcontainers/containers/DefaultRecordingFileFactoryTest.java

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package org.testcontainers.containers;
22

33
import lombok.Value;
4-
import org.junit.Test;
5-
import org.junit.runner.Description;
6-
import org.junit.runner.RunWith;
7-
import org.junit.runners.Parameterized;
4+
import org.junit.jupiter.api.Test;
5+
import org.junit.jupiter.api.TestInfo;
6+
import org.junit.jupiter.params.ParameterizedClass;
7+
import org.junit.jupiter.params.provider.MethodSource;
88

99
import java.io.File;
1010
import java.nio.file.Files;
@@ -17,9 +17,10 @@
1717

1818
import static org.assertj.core.api.Assertions.assertThat;
1919

20-
@RunWith(Parameterized.class)
20+
@ParameterizedClass
21+
@MethodSource("data")
2122
@Value
22-
public class DefaultRecordingFileFactoryTest {
23+
class DefaultRecordingFileFactoryTest {
2324

2425
private static final DateTimeFormatter DATETIME_FORMATTER = DateTimeFormatter.ofPattern("YYYYMMdd-HHmmss");
2526

@@ -31,7 +32,6 @@ public class DefaultRecordingFileFactoryTest {
3132

3233
private final boolean success;
3334

34-
@Parameterized.Parameters
3535
public static Collection<Object[]> data() {
3636
Collection<Object[]> args = new ArrayList<>();
3737
args.add(new Object[] { "testMethod1", "FAILED", Boolean.FALSE });
@@ -40,13 +40,10 @@ public static Collection<Object[]> data() {
4040
}
4141

4242
@Test
43-
public void recordingFileThatShouldDescribeTheTestResultAtThePresentTime() throws Exception {
43+
public void recordingFileThatShouldDescribeTheTestResultAtThePresentTime(TestInfo testInfo) throws Exception {
4444
File vncRecordingDirectory = Files.createTempDirectory("recording").toFile();
45-
Description description = Description.createTestDescription(
46-
getClass().getCanonicalName(),
47-
methodName,
48-
Test.class
49-
);
45+
String className = testInfo.getTestClass().orElseThrow(IllegalStateException::new).getSimpleName();
46+
String description = className + "-" + methodName;
5047

5148
File recordingFile = factory.recordingFileForTest(vncRecordingDirectory, description, success);
5249

0 commit comments

Comments
 (0)