Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import java.util.EnumSet;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assume.assumeFalse;
import static org.assertj.core.api.Assumptions.assumeThat;

@ParameterizedClass
@MethodSource("data")
Expand Down Expand Up @@ -207,7 +207,7 @@ private HikariDataSource verifyCharacterSet(String jdbcUrl) throws SQLException
}

private void performTestForCustomIniFile(HikariDataSource dataSource) throws SQLException {
assumeFalse(SystemUtils.IS_OS_WINDOWS);
assumeThat(SystemUtils.IS_OS_WINDOWS).isFalse();
Statement statement = dataSource.getConnection().createStatement();
statement.execute("SELECT @@GLOBAL.innodb_max_undo_log_size");
ResultSet resultSet = statement.getResultSet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.junit.jupiter.api.TestMethodOrder;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assume.assumeTrue;
import static org.assertj.core.api.Assumptions.assumeThat;

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

@Test
@Order(2)
void should_have_captured_thrownException() {
Throwable capturedThrowable = startedTestContainer.getCapturedThrowable();
assertThat(capturedThrowable).isInstanceOf(AssumptionViolatedException.class);
assertThat(capturedThrowable.getMessage()).isEqualTo("got: <false>, expected: is <true>");
assertThat(capturedThrowable.getMessage()).contains("Expecting value to be true but was false");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assumptions.assumeThat;
import static org.junit.Assume.assumeFalse;

class SimpleMariaDBTest extends AbstractContainerDatabaseTest {

Expand Down Expand Up @@ -58,7 +57,7 @@ void testSpecificVersion() throws SQLException {

@Test
void testMariaDBWithCustomIniFile() throws SQLException {
assumeFalse(SystemUtils.IS_OS_WINDOWS);
assumeThat(SystemUtils.IS_OS_WINDOWS).isFalse();

try (
MariaDBContainer<?> mariadbCustomConfig = new MariaDBContainer<>(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
package org.testcontainers.containers;

import org.junit.runner.Description;
import org.testcontainers.containers.VncRecordingContainer.VncRecordingFormat;

import java.io.File;

public interface RecordingFileFactory {
@Deprecated
default File recordingFileForTest(File vncRecordingDirectory, Description description, boolean succeeded) {
return recordingFileForTest(
vncRecordingDirectory,
description.getTestClass().getSimpleName() + "-" + description.getMethodName(),
succeeded
);
}

default File recordingFileForTest(
File vncRecordingDirectory,
String prefix,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.testcontainers.containers;

import lombok.Value;
import org.junit.Test;
import org.junit.runner.Description;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo;
import org.junit.jupiter.params.ParameterizedClass;
import org.junit.jupiter.params.provider.MethodSource;

import java.io.File;
import java.nio.file.Files;
Expand All @@ -17,9 +17,10 @@

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

@RunWith(Parameterized.class)
@ParameterizedClass
@MethodSource("data")
@Value
public class DefaultRecordingFileFactoryTest {
class DefaultRecordingFileFactoryTest {

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

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

private final boolean success;

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

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

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

Expand Down
Loading