From 1fe6c1fd143cb7b85e4b666435950f740098648f Mon Sep 17 00:00:00 2001 From: svc-excavator-bot Date: Tue, 7 Jun 2022 12:44:20 +0000 Subject: [PATCH] Excavator: Switch to JUnit 5 to parallelize tests and speed up CI --- docker-compose-rule-core/build.gradle | 8 ++++++++ ...AggressiveShutdownStrategyIntegrationTest.java | 2 +- ...WithNetworkCleanupStrategyIntegrationTest.java | 2 +- ...seManagerNativeHealthcheckIntegrationTest.java | 6 +++--- ...rComposeManagerUpContainerIntegrationTest.java | 6 +++--- .../docker/compose/EventsIntegrationTest.java | 2 +- .../HostNetworkedPortsIntegrationTest.java | 2 +- ...emoveConflictingContainersIntegrationTest.java | 2 +- .../connection/ContainerIntegrationTests.java | 2 +- .../EnvironmentVariableIntegrationTest.java | 10 +++++----- .../compose/logging/LoggingIntegrationTest.java | 13 ++++++------- .../reporting/ReportingIntegrationTest.java | 2 +- .../compose/AggressiveShutdownStrategyTest.java | 2 +- ...iveShutdownWithNetworkCleanupStrategyTest.java | 2 +- .../compose/DockerComposeManagerShould.java | 15 +++++++++------ .../docker/compose/EventEmitterShould.java | 2 +- .../AdditionalEnvironmentValidatorShould.java | 2 +- .../DaemonEnvironmentValidatorShould.java | 2 +- .../configuration/DaemonHostIpResolverShould.java | 2 +- .../configuration/DockerComposeFilesShould.java | 2 +- .../DockerComposeRuleConfigTest.java | 2 +- .../compose/configuration/DockerTypeShould.java | 2 +- .../compose/configuration/ProjectNameShould.java | 2 +- .../RemoteEnvironmentValidatorShould.java | 2 +- .../configuration/RemoteHostIpResolverShould.java | 2 +- .../compose/connection/ContainerCacheShould.java | 2 +- .../compose/connection/ContainerNameShould.java | 2 +- .../compose/connection/ContainerShould.java | 2 +- .../connection/DockerPortFormattingShould.java | 2 +- .../compose/connection/LocalBuilderShould.java | 2 +- .../docker/compose/connection/PortsShould.java | 2 +- .../compose/connection/RemoteBuilderShould.java | 2 +- .../connection/waiting/ClusterWaitShould.java | 7 +++++-- .../connection/waiting/ExceptionsShould.java | 2 +- .../connection/waiting/HttpHealthCheckShould.java | 2 +- .../waiting/PortsHealthCheckShould.java | 2 +- .../waiting/SuccessOrFailureShould.java | 2 +- ...allbackThenDelegateShutdownStrategyShould.java | 2 +- .../docker/compose/execution/CommandShould.java | 15 +++++++++------ ...ctingContainerRemovingDockerComposeShould.java | 2 +- .../execution/DockerCommandLocationsShould.java | 14 +++++++------- .../execution/DockerComposeExecOptionShould.java | 2 +- .../compose/execution/DockerComposeShould.java | 6 +++--- .../execution/DockerComposeVersionShould.java | 2 +- .../docker/compose/execution/DockerShould.java | 6 +++--- .../execution/GracefulShutdownStrategyShould.java | 2 +- .../execution/KillDownShutdownStrategyShould.java | 2 +- .../docker/compose/execution/RetryerShould.java | 11 +++++++---- .../execution/RetryingDockerComposeShould.java | 6 +++--- .../compose/logging/FileLogCollectorShould.java | 6 +++--- .../docker/compose/logging/LogDirectoryTest.java | 2 +- .../matchers/AvailablePortMatcherShould.java | 2 +- .../compose/reporting/HttpJsonPosterTest.java | 2 +- .../compose/reporting/PatternCollectionTest.java | 2 +- .../compose/reporting/ReportCompilerTest.java | 2 +- .../docker/compose/reporting/RunRecorderTest.java | 2 +- docker-compose-rule-junit4/build.gradle | 8 ++++++++ .../compose/DockerComposeRuleIntegrationTest.java | 2 +- .../docker/compose/DockerComposeRuleShould.java | 15 +++++++++------ versions.lock | 7 ++++--- versions.props | 1 + 61 files changed, 139 insertions(+), 107 deletions(-) diff --git a/docker-compose-rule-core/build.gradle b/docker-compose-rule-core/build.gradle index 9fa8c50b3..781994814 100644 --- a/docker-compose-rule-core/build.gradle +++ b/docker-compose-rule-core/build.gradle @@ -28,4 +28,12 @@ dependencies { testImplementation 'com.github.tomakehurst:wiremock' integrationTestCompile project.sourceSets.test.output + integrationTestImplementation 'org.junit.jupiter:junit-jupiter' + integrationTestRuntimeOnly 'org.junit.vintage:junit-vintage-engine', { + because 'allows JUnit 3 and JUnit 4 tests to run' + } + testImplementation 'org.junit.jupiter:junit-jupiter' + testRuntimeOnly 'org.junit.vintage:junit-vintage-engine', { + because 'allows JUnit 3 and JUnit 4 tests to run' + } } diff --git a/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/AggressiveShutdownStrategyIntegrationTest.java b/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/AggressiveShutdownStrategyIntegrationTest.java index 119b07fff..57a863125 100644 --- a/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/AggressiveShutdownStrategyIntegrationTest.java +++ b/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/AggressiveShutdownStrategyIntegrationTest.java @@ -23,7 +23,7 @@ import com.palantir.docker.compose.logging.DoNothingLogCollector; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class AggressiveShutdownStrategyIntegrationTest { diff --git a/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/AggressiveShutdownWithNetworkCleanupStrategyIntegrationTest.java b/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/AggressiveShutdownWithNetworkCleanupStrategyIntegrationTest.java index e4dade583..ea04a7aee 100644 --- a/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/AggressiveShutdownWithNetworkCleanupStrategyIntegrationTest.java +++ b/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/AggressiveShutdownWithNetworkCleanupStrategyIntegrationTest.java @@ -26,7 +26,7 @@ import java.util.HashSet; import java.util.Set; import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class AggressiveShutdownWithNetworkCleanupStrategyIntegrationTest { diff --git a/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/DockerComposeManagerNativeHealthcheckIntegrationTest.java b/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/DockerComposeManagerNativeHealthcheckIntegrationTest.java index 202847c99..05ed75285 100644 --- a/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/DockerComposeManagerNativeHealthcheckIntegrationTest.java +++ b/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/DockerComposeManagerNativeHealthcheckIntegrationTest.java @@ -37,15 +37,15 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import org.hamcrest.Matchers; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; public class DockerComposeManagerNativeHealthcheckIntegrationTest { private final ExecutorService pool = Executors.newFixedThreadPool(1); private DockerComposeManager docker = null; - @After + @AfterEach public void shutdownPool() { pool.shutdown(); if (docker != null) { diff --git a/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/DockerComposeManagerUpContainerIntegrationTest.java b/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/DockerComposeManagerUpContainerIntegrationTest.java index 3ea491dae..3fa7dccac 100644 --- a/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/DockerComposeManagerUpContainerIntegrationTest.java +++ b/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/DockerComposeManagerUpContainerIntegrationTest.java @@ -27,8 +27,8 @@ import com.palantir.docker.compose.connection.waiting.ClusterWait; import java.io.IOException; import org.joda.time.Duration; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class DockerComposeManagerUpContainerIntegrationTest { @@ -36,7 +36,7 @@ public class DockerComposeManagerUpContainerIntegrationTest { private DockerComposeManager dockerComposeManager; - @Before + @BeforeEach public void before() throws Exception { dockerComposeManager = new DockerComposeManager.Builder() .shutdownStrategy(AGGRESSIVE) diff --git a/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/EventsIntegrationTest.java b/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/EventsIntegrationTest.java index e39f2cb23..3d8d987b1 100644 --- a/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/EventsIntegrationTest.java +++ b/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/EventsIntegrationTest.java @@ -37,7 +37,7 @@ import com.palantir.docker.compose.events.WaitForServicesEvent; import java.util.List; import java.util.Optional; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; @SuppressWarnings("IllegalThrows") diff --git a/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/HostNetworkedPortsIntegrationTest.java b/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/HostNetworkedPortsIntegrationTest.java index 4e1215f7b..4e33bded2 100644 --- a/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/HostNetworkedPortsIntegrationTest.java +++ b/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/HostNetworkedPortsIntegrationTest.java @@ -25,7 +25,7 @@ import com.palantir.docker.compose.connection.waiting.SuccessOrFailure; import org.apache.commons.lang3.SystemUtils; import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class HostNetworkedPortsIntegrationTest { private static HealthCheck toBeOpen() { diff --git a/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/RemoveConflictingContainersIntegrationTest.java b/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/RemoveConflictingContainersIntegrationTest.java index de0546c8b..afb598679 100644 --- a/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/RemoveConflictingContainersIntegrationTest.java +++ b/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/RemoveConflictingContainersIntegrationTest.java @@ -21,7 +21,7 @@ import com.palantir.docker.compose.execution.DockerExecutionException; import java.io.IOException; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.junit.rules.ExpectedException; public class RemoveConflictingContainersIntegrationTest { diff --git a/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/connection/ContainerIntegrationTests.java b/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/connection/ContainerIntegrationTests.java index 613adaa93..0fe91f62a 100644 --- a/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/connection/ContainerIntegrationTests.java +++ b/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/connection/ContainerIntegrationTests.java @@ -35,7 +35,7 @@ import java.time.Duration; import org.awaitility.core.ConditionFactory; import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ContainerIntegrationTests { diff --git a/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/execution/EnvironmentVariableIntegrationTest.java b/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/execution/EnvironmentVariableIntegrationTest.java index 36a2a9bea..e8161ef3d 100644 --- a/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/execution/EnvironmentVariableIntegrationTest.java +++ b/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/execution/EnvironmentVariableIntegrationTest.java @@ -22,15 +22,15 @@ import com.palantir.docker.compose.DockerComposeManager; import com.palantir.docker.compose.connection.DockerMachine; +import java.io.File; import java.nio.file.Path; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; public class EnvironmentVariableIntegrationTest { - @Rule - public TemporaryFolder temporaryFolder = new TemporaryFolder(); + @TempDir + public File temporaryFolder; @Test public void docker_compose_gets_environment_variables_from_docker_machine_and_passes_it_into_a_test_container() diff --git a/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/logging/LoggingIntegrationTest.java b/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/logging/LoggingIntegrationTest.java index 33fe0ff9c..de074202a 100644 --- a/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/logging/LoggingIntegrationTest.java +++ b/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/logging/LoggingIntegrationTest.java @@ -24,19 +24,18 @@ import com.palantir.docker.compose.DockerComposeManager; import java.io.File; import java.io.IOException; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; public class LoggingIntegrationTest { - @Rule - public TemporaryFolder logFolder = new TemporaryFolder(); + @TempDir + public File logFolder; private DockerComposeManager dockerComposeRule; - @Before + @BeforeEach public void before() { dockerComposeRule = new DockerComposeManager.Builder() .file("src/test/resources/docker-compose.yaml") diff --git a/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/reporting/ReportingIntegrationTest.java b/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/reporting/ReportingIntegrationTest.java index 60fc49d37..b555a149a 100644 --- a/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/reporting/ReportingIntegrationTest.java +++ b/docker-compose-rule-core/src/integrationTest/java/com/palantir/docker/compose/reporting/ReportingIntegrationTest.java @@ -35,7 +35,7 @@ import java.nio.file.Paths; import java.util.concurrent.TimeUnit; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.junit.rules.TemporaryFolder; public class ReportingIntegrationTest { diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/AggressiveShutdownStrategyTest.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/AggressiveShutdownStrategyTest.java index 64e76132e..7f4b2b425 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/AggressiveShutdownStrategyTest.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/AggressiveShutdownStrategyTest.java @@ -27,7 +27,7 @@ import com.palantir.docker.compose.execution.DockerCompose; import com.palantir.docker.compose.execution.DockerExecutionException; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.junit.rules.ExpectedException; public class AggressiveShutdownStrategyTest { diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/AggressiveShutdownWithNetworkCleanupStrategyTest.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/AggressiveShutdownWithNetworkCleanupStrategyTest.java index 2c06f5973..f3a4ccff9 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/AggressiveShutdownWithNetworkCleanupStrategyTest.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/AggressiveShutdownWithNetworkCleanupStrategyTest.java @@ -27,7 +27,7 @@ import com.palantir.docker.compose.execution.DockerCompose; import com.palantir.docker.compose.execution.DockerExecutionException; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.junit.rules.ExpectedException; public class AggressiveShutdownWithNetworkCleanupStrategyTest { diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/DockerComposeManagerShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/DockerComposeManagerShould.java index b52b56cb7..ddc3b2485 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/DockerComposeManagerShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/DockerComposeManagerShould.java @@ -58,18 +58,21 @@ import java.util.concurrent.atomic.AtomicInteger; import org.apache.commons.io.IOUtils; import org.joda.time.Duration; -import org.junit.Before; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.junit.rules.ExpectedException; import org.junit.rules.TemporaryFolder; -import org.junit.runner.RunWith; import org.mockito.InOrder; import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; +import org.mockito.junit.jupiter.MockitoSettings; +import org.mockito.quality.Strictness; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) +@MockitoSettings(strictness = Strictness.LENIENT) public final class DockerComposeManagerShould { private static final String IP = "127.0.0.1"; @@ -91,7 +94,7 @@ public final class DockerComposeManagerShould { private LogCollector logCollector = mock(LogCollector.class); private DockerComposeManager dockerComposeManager; - @Before + @BeforeEach public void before() { when(machine.getIp()).thenReturn(IP); dockerComposeManager = defaultBuilder().build(); diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/EventEmitterShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/EventEmitterShould.java index 70e56625f..21f667dd8 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/EventEmitterShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/EventEmitterShould.java @@ -42,7 +42,7 @@ import java.time.OffsetDateTime; import java.time.ZoneOffset; import java.util.concurrent.atomic.AtomicReference; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.mockito.InOrder; import org.mockito.Mockito; diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/AdditionalEnvironmentValidatorShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/AdditionalEnvironmentValidatorShould.java index 427c71205..4430eab59 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/AdditionalEnvironmentValidatorShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/AdditionalEnvironmentValidatorShould.java @@ -21,7 +21,7 @@ import com.google.common.collect.ImmutableMap; import java.util.Map; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.junit.rules.ExpectedException; public class AdditionalEnvironmentValidatorShould { diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/DaemonEnvironmentValidatorShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/DaemonEnvironmentValidatorShould.java index 55a266825..7b0ad0809 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/DaemonEnvironmentValidatorShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/DaemonEnvironmentValidatorShould.java @@ -22,7 +22,7 @@ import com.google.common.collect.ImmutableMap; import java.util.Map; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.junit.rules.ExpectedException; public class DaemonEnvironmentValidatorShould { diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/DaemonHostIpResolverShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/DaemonHostIpResolverShould.java index f82a91b4b..490667111 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/DaemonHostIpResolverShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/DaemonHostIpResolverShould.java @@ -19,7 +19,7 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class DaemonHostIpResolverShould { diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/DockerComposeFilesShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/DockerComposeFilesShould.java index 25ca86125..aaaee2699 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/DockerComposeFilesShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/DockerComposeFilesShould.java @@ -22,7 +22,7 @@ import java.io.File; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.junit.rules.ExpectedException; import org.junit.rules.TemporaryFolder; diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/DockerComposeRuleConfigTest.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/DockerComposeRuleConfigTest.java index d989a355b..4f30cc579 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/DockerComposeRuleConfigTest.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/DockerComposeRuleConfigTest.java @@ -26,7 +26,7 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.junit.rules.ExpectedException; import org.junit.rules.TemporaryFolder; diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/DockerTypeShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/DockerTypeShould.java index cc6c8b14e..37ad23ad8 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/DockerTypeShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/DockerTypeShould.java @@ -24,7 +24,7 @@ import com.google.common.collect.ImmutableMap; import java.util.Map; import java.util.Optional; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class DockerTypeShould { diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/ProjectNameShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/ProjectNameShould.java index 8bafd8db8..3aa3179c5 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/ProjectNameShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/ProjectNameShould.java @@ -25,7 +25,7 @@ import java.util.List; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.junit.rules.ExpectedException; public class ProjectNameShould { diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/RemoteEnvironmentValidatorShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/RemoteEnvironmentValidatorShould.java index 294395428..27a83531c 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/RemoteEnvironmentValidatorShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/RemoteEnvironmentValidatorShould.java @@ -22,7 +22,7 @@ import com.google.common.collect.ImmutableMap; import java.util.Map; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.junit.rules.ExpectedException; public class RemoteEnvironmentValidatorShould { diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/RemoteHostIpResolverShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/RemoteHostIpResolverShould.java index 118b6128d..694356964 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/RemoteHostIpResolverShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/configuration/RemoteHostIpResolverShould.java @@ -20,7 +20,7 @@ import org.hamcrest.Matchers; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.junit.rules.ExpectedException; public class RemoteHostIpResolverShould { diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/ContainerCacheShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/ContainerCacheShould.java index 57459b883..d93651757 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/ContainerCacheShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/ContainerCacheShould.java @@ -22,7 +22,7 @@ import com.palantir.docker.compose.execution.Docker; import com.palantir.docker.compose.execution.DockerCompose; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ContainerCacheShould { diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/ContainerNameShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/ContainerNameShould.java index 8f4aecb95..7773d117e 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/ContainerNameShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/ContainerNameShould.java @@ -22,7 +22,7 @@ import static org.hamcrest.core.Is.is; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ContainerNameShould { diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/ContainerShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/ContainerShould.java index b77e1ddcd..5fd4dfeaf 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/ContainerShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/ContainerShould.java @@ -31,7 +31,7 @@ import com.palantir.docker.compose.execution.DockerCompose; import java.io.IOException; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.junit.rules.ExpectedException; public class ContainerShould { diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/DockerPortFormattingShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/DockerPortFormattingShould.java index d3eaf2b11..131f99388 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/DockerPortFormattingShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/DockerPortFormattingShould.java @@ -18,7 +18,7 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class DockerPortFormattingShould { private final DockerPort dockerPort = new DockerPort("hostname", 1234, 4321); diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/LocalBuilderShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/LocalBuilderShould.java index a1ad2845a..b2ccdca11 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/LocalBuilderShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/LocalBuilderShould.java @@ -31,7 +31,7 @@ import java.util.HashMap; import java.util.Map; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.junit.rules.ExpectedException; public class LocalBuilderShould { diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/PortsShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/PortsShould.java index a7a936504..398d0259c 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/PortsShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/PortsShould.java @@ -21,7 +21,7 @@ import static org.hamcrest.core.Is.is; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.junit.rules.ExpectedException; public class PortsShould { diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/RemoteBuilderShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/RemoteBuilderShould.java index d0762a5ca..f5c8d8267 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/RemoteBuilderShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/RemoteBuilderShould.java @@ -23,7 +23,7 @@ import com.google.common.collect.ImmutableMap; import java.util.Map; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.junit.rules.ExpectedException; public class RemoteBuilderShould { diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/waiting/ClusterWaitShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/waiting/ClusterWaitShould.java index 63ce58b9f..713ae2701 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/waiting/ClusterWaitShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/waiting/ClusterWaitShould.java @@ -25,9 +25,11 @@ import com.palantir.docker.compose.connection.Cluster; import com.palantir.docker.compose.connection.ContainerCache; import com.palantir.docker.compose.connection.ImmutableCluster; +import java.util.concurrent.TimeUnit; import org.joda.time.Duration; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Timeout; import org.junit.rules.ExpectedException; public class ClusterWaitShould { @@ -59,7 +61,8 @@ public void check_until_a_cluster_is_ready() throws InterruptedException { verify(clusterHealthCheck, times(2)).isClusterHealthy(cluster); } - @Test(timeout = 2000L) + @Test + @Timeout(value = 2000L, unit = TimeUnit.MILLISECONDS) public void timeout_if_the_cluster_is_not_healthy() throws InterruptedException { when(clusterHealthCheck.isClusterHealthy(cluster)).thenReturn(failure("failure!")); diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/waiting/ExceptionsShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/waiting/ExceptionsShould.java index 01f131c9b..a4013ee6a 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/waiting/ExceptionsShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/waiting/ExceptionsShould.java @@ -18,7 +18,7 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ExceptionsShould { @Test diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/waiting/HttpHealthCheckShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/waiting/HttpHealthCheckShould.java index 439704be5..2bee3c7eb 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/waiting/HttpHealthCheckShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/waiting/HttpHealthCheckShould.java @@ -26,7 +26,7 @@ import com.palantir.docker.compose.connection.Container; import com.palantir.docker.compose.connection.DockerPort; import java.util.function.Function; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class HttpHealthCheckShould { private static final Function URL_FUNCTION = _port -> null; diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/waiting/PortsHealthCheckShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/waiting/PortsHealthCheckShould.java index b55551ca2..4093430a5 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/waiting/PortsHealthCheckShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/waiting/PortsHealthCheckShould.java @@ -23,7 +23,7 @@ import static org.mockito.Mockito.when; import com.palantir.docker.compose.connection.Container; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class PortsHealthCheckShould { private final HealthCheck healthCheck = HealthChecks.toHaveAllPortsOpen(); diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/waiting/SuccessOrFailureShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/waiting/SuccessOrFailureShould.java index 0b05e223a..4e2756fd3 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/waiting/SuccessOrFailureShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/connection/waiting/SuccessOrFailureShould.java @@ -23,7 +23,7 @@ import static org.hamcrest.Matchers.containsString; import static org.hamcrest.core.Is.is; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class SuccessOrFailureShould { @Test diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/CallbackThenDelegateShutdownStrategyShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/CallbackThenDelegateShutdownStrategyShould.java index e074bf9b7..2d1ce35cf 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/CallbackThenDelegateShutdownStrategyShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/CallbackThenDelegateShutdownStrategyShould.java @@ -25,7 +25,7 @@ import static org.mockito.Mockito.verifyNoMoreInteractions; import com.palantir.docker.compose.configuration.ShutdownStrategy; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.mockito.InOrder; public class CallbackThenDelegateShutdownStrategyShould { diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/CommandShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/CommandShould.java index e9c99a26a..ff06dee62 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/CommandShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/CommandShould.java @@ -27,14 +27,17 @@ import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; -import org.junit.Before; import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; +import org.mockito.junit.jupiter.MockitoSettings; +import org.mockito.quality.Strictness; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) +@MockitoSettings(strictness = Strictness.LENIENT) public class CommandShould { @Mock private Process executedProcess; @@ -49,7 +52,7 @@ public class CommandShould { private final List consumedLogLines = new ArrayList<>(); private final Consumer logConsumer = consumedLogLines::add; - @Before + @BeforeEach public void before() throws IOException { when(dockerComposeExecutable.execute(any())).thenReturn(executedProcess); dockerComposeCommand = new Command(dockerComposeExecutable, logConsumer); diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/ConflictingContainerRemovingDockerComposeShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/ConflictingContainerRemovingDockerComposeShould.java index ca2f733b2..e478805c6 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/ConflictingContainerRemovingDockerComposeShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/ConflictingContainerRemovingDockerComposeShould.java @@ -27,7 +27,7 @@ import java.io.IOException; import java.util.Set; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.junit.rules.ExpectedException; public class ConflictingContainerRemovingDockerComposeShould { diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/DockerCommandLocationsShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/DockerCommandLocationsShould.java index aea94bc50..65be85501 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/DockerCommandLocationsShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/DockerCommandLocationsShould.java @@ -19,22 +19,22 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; +import java.io.File; import java.io.IOException; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; public class DockerCommandLocationsShould { private static final String badLocation = "file/that/does/not/exist"; private static final String otherBadLocation = "another/file/that/does/not/exist"; - @Rule - public TemporaryFolder folder = new TemporaryFolder(); + @TempDir + public File folder; private String goodLocation; - @Before + @BeforeEach public void before() throws IOException { goodLocation = folder.newFile("docker-compose.yml").getAbsolutePath(); } diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/DockerComposeExecOptionShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/DockerComposeExecOptionShould.java index ffc0e2df3..de12ebd02 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/DockerComposeExecOptionShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/DockerComposeExecOptionShould.java @@ -20,7 +20,7 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.collection.IsEmptyCollection.empty; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class DockerComposeExecOptionShould { diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/DockerComposeShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/DockerComposeShould.java index 07bf0ce14..742fef868 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/DockerComposeShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/DockerComposeShould.java @@ -38,9 +38,9 @@ import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.List; -import org.junit.Before; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.junit.rules.ExpectedException; public class DockerComposeShould { @@ -55,7 +55,7 @@ public class DockerComposeShould { private final Process executedProcess = mock(Process.class); private final Container container = mock(Container.class); - @Before + @BeforeEach public void before() throws IOException { when(dockerMachine.getIp()).thenReturn("0.0.0.0"); when(executor.execute(anyVararg())).thenReturn(executedProcess); diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/DockerComposeVersionShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/DockerComposeVersionShould.java index fa82e9161..1d3459d9c 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/DockerComposeVersionShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/DockerComposeVersionShould.java @@ -21,7 +21,7 @@ import static org.hamcrest.Matchers.lessThan; import com.github.zafarkhaja.semver.Version; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class DockerComposeVersionShould { diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/DockerShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/DockerShould.java index 89ee99b49..dc6221ae3 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/DockerShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/DockerShould.java @@ -25,8 +25,8 @@ import com.github.zafarkhaja.semver.Version; import java.io.IOException; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class DockerShould { @@ -35,7 +35,7 @@ public class DockerShould { private final Process executedProcess = mock(Process.class); - @Before + @BeforeEach public void before() throws IOException { when(executor.execute(anyVararg())).thenReturn(executedProcess); when(executedProcess.exitValue()).thenReturn(0); diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/GracefulShutdownStrategyShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/GracefulShutdownStrategyShould.java index e56918bf9..537d75f03 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/GracefulShutdownStrategyShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/GracefulShutdownStrategyShould.java @@ -21,7 +21,7 @@ import static org.mockito.Mockito.verifyNoMoreInteractions; import com.palantir.docker.compose.configuration.ShutdownStrategy; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.mockito.InOrder; public class GracefulShutdownStrategyShould { diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/KillDownShutdownStrategyShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/KillDownShutdownStrategyShould.java index 5765f8913..430517507 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/KillDownShutdownStrategyShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/KillDownShutdownStrategyShould.java @@ -21,7 +21,7 @@ import static org.mockito.Mockito.verifyNoMoreInteractions; import com.palantir.docker.compose.configuration.ShutdownStrategy; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.mockito.InOrder; public class KillDownShutdownStrategyShould { diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/RetryerShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/RetryerShould.java index abf1ad659..54e60ea45 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/RetryerShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/RetryerShould.java @@ -28,12 +28,15 @@ import com.palantir.docker.compose.utils.MockitoMultiAnswer; import java.util.concurrent.TimeUnit; import org.joda.time.Duration; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; +import org.mockito.junit.jupiter.MockitoSettings; +import org.mockito.quality.Strictness; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) +@MockitoSettings(strictness = Strictness.LENIENT) public class RetryerShould { @Mock private Retryer.RetryableDockerOperation operation; diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/RetryingDockerComposeShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/RetryingDockerComposeShould.java index 4f8bf64f6..b644e19cd 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/RetryingDockerComposeShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/RetryingDockerComposeShould.java @@ -31,8 +31,8 @@ import com.palantir.docker.compose.execution.Retryer.RetryableDockerOperation; import java.io.IOException; import java.util.List; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RetryingDockerComposeShould { private final DockerCompose dockerCompose = mock(DockerCompose.class); @@ -41,7 +41,7 @@ public class RetryingDockerComposeShould { private final List someContainerNames = TestContainerNames.of("hey"); private static final String CONTAINER_NAME = "container"; - @Before + @BeforeEach public void before() throws IOException, InterruptedException { retryerJustCallsOperation(); } diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/logging/FileLogCollectorShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/logging/FileLogCollectorShould.java index ae2de5323..54ed8ebd4 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/logging/FileLogCollectorShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/logging/FileLogCollectorShould.java @@ -35,9 +35,9 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import org.apache.commons.io.IOUtils; -import org.junit.Before; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.junit.rules.ExpectedException; import org.junit.rules.TemporaryFolder; @@ -54,7 +54,7 @@ public class FileLogCollectorShould { private File logDirectory; private LogCollector logCollector; - @Before + @BeforeEach public void before() throws IOException { logDirectory = logDirectoryParent.newFolder(); logCollector = new FileLogCollector(logDirectory); diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/logging/LogDirectoryTest.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/logging/LogDirectoryTest.java index ff3ab4677..755606188 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/logging/LogDirectoryTest.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/logging/LogDirectoryTest.java @@ -20,8 +20,8 @@ import static org.hamcrest.Matchers.is; import org.junit.Rule; -import org.junit.Test; import org.junit.contrib.java.lang.system.EnvironmentVariables; +import org.junit.jupiter.api.Test; public class LogDirectoryTest { diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/matchers/AvailablePortMatcherShould.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/matchers/AvailablePortMatcherShould.java index 26d430579..0e857bbea 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/matchers/AvailablePortMatcherShould.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/matchers/AvailablePortMatcherShould.java @@ -23,7 +23,7 @@ import com.palantir.docker.compose.connection.DockerPort; import java.util.List; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.junit.rules.ExpectedException; public class AvailablePortMatcherShould { diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/reporting/HttpJsonPosterTest.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/reporting/HttpJsonPosterTest.java index d1646a3f3..45cc2dbb9 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/reporting/HttpJsonPosterTest.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/reporting/HttpJsonPosterTest.java @@ -26,7 +26,7 @@ import com.github.tomakehurst.wiremock.junit.WireMockRule; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class HttpJsonPosterTest { private final ReportingConfig reportingConfig = mock(ReportingConfig.class); diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/reporting/PatternCollectionTest.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/reporting/PatternCollectionTest.java index 1044132e2..fa457709e 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/reporting/PatternCollectionTest.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/reporting/PatternCollectionTest.java @@ -20,7 +20,7 @@ import com.google.common.collect.ImmutableList; import java.util.regex.Pattern; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class PatternCollectionTest { private final PatternCollection patternCollection = diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/reporting/ReportCompilerTest.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/reporting/ReportCompilerTest.java index ef57cdd7a..a139b5f4f 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/reporting/ReportCompilerTest.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/reporting/ReportCompilerTest.java @@ -30,7 +30,7 @@ import java.time.OffsetDateTime; import java.time.ZoneOffset; import java.util.function.Consumer; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; public class ReportCompilerTest { diff --git a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/reporting/RunRecorderTest.java b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/reporting/RunRecorderTest.java index eacf0982a..9b1c80121 100644 --- a/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/reporting/RunRecorderTest.java +++ b/docker-compose-rule-core/src/test/java/com/palantir/docker/compose/reporting/RunRecorderTest.java @@ -32,7 +32,7 @@ import java.time.ZoneId; import java.time.ZoneOffset; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; public class RunRecorderTest { diff --git a/docker-compose-rule-junit4/build.gradle b/docker-compose-rule-junit4/build.gradle index b2bc9f277..a8a800f3a 100644 --- a/docker-compose-rule-junit4/build.gradle +++ b/docker-compose-rule-junit4/build.gradle @@ -13,4 +13,12 @@ dependencies { testCompile 'org.hamcrest:hamcrest-core' testCompile 'org.mockito:mockito-inline' testCompile 'org.assertj:assertj-core' + integrationTestImplementation 'org.junit.jupiter:junit-jupiter' + integrationTestRuntimeOnly 'org.junit.vintage:junit-vintage-engine', { + because 'allows JUnit 3 and JUnit 4 tests to run' + } + testImplementation 'org.junit.jupiter:junit-jupiter' + testRuntimeOnly 'org.junit.vintage:junit-vintage-engine', { + because 'allows JUnit 3 and JUnit 4 tests to run' + } } diff --git a/docker-compose-rule-junit4/src/integrationTest/java/com/palantir/docker/compose/DockerComposeRuleIntegrationTest.java b/docker-compose-rule-junit4/src/integrationTest/java/com/palantir/docker/compose/DockerComposeRuleIntegrationTest.java index 0793bfcc9..fbc250c14 100644 --- a/docker-compose-rule-junit4/src/integrationTest/java/com/palantir/docker/compose/DockerComposeRuleIntegrationTest.java +++ b/docker-compose-rule-junit4/src/integrationTest/java/com/palantir/docker/compose/DockerComposeRuleIntegrationTest.java @@ -36,7 +36,7 @@ import java.util.function.Consumer; import org.junit.Ignore; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.junit.rules.ExpectedException; import org.junit.rules.TemporaryFolder; diff --git a/docker-compose-rule-junit4/src/test/java/com/palantir/docker/compose/DockerComposeRuleShould.java b/docker-compose-rule-junit4/src/test/java/com/palantir/docker/compose/DockerComposeRuleShould.java index 825446643..dae4503ee 100644 --- a/docker-compose-rule-junit4/src/test/java/com/palantir/docker/compose/DockerComposeRuleShould.java +++ b/docker-compose-rule-junit4/src/test/java/com/palantir/docker/compose/DockerComposeRuleShould.java @@ -26,17 +26,20 @@ import com.palantir.docker.compose.execution.DockerCompose; import com.palantir.docker.compose.execution.DockerExecutionException; import com.palantir.docker.compose.logging.LogCollector; -import org.junit.Before; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.junit.rules.ExpectedException; import org.junit.rules.TemporaryFolder; import org.junit.runner.Description; -import org.junit.runner.RunWith; import org.junit.runners.model.Statement; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; +import org.mockito.junit.jupiter.MockitoSettings; +import org.mockito.quality.Strictness; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) +@MockitoSettings(strictness = Strictness.LENIENT) public class DockerComposeRuleShould { private static final String IP = "127.0.0.1"; @@ -53,7 +56,7 @@ public class DockerComposeRuleShould { private LogCollector logCollector = mock(LogCollector.class); private DockerComposeRule rule; - @Before + @BeforeEach public void before() { when(machine.getIp()).thenReturn(IP); rule = defaultBuilder().build(); diff --git a/versions.lock b/versions.lock index 01f124597..358e29822 100644 --- a/versions.lock +++ b/versions.lock @@ -26,10 +26,10 @@ jakarta.annotation:jakarta.annotation-api:1.3.5 (1 constraints: f10f7399) jakarta.ws.rs:jakarta.ws.rs-api:2.1.6 (1 constraints: f10f7399) javax.annotation:javax.annotation-api:1.3.2 (1 constraints: 0805fb35) joda-time:joda-time:2.10.8 (2 constraints: 651b4e70) -junit:junit:4.13 (4 constraints: 362657b7) +junit:junit:4.13 (5 constraints: 84369743) one.util:streamex:0.7.2 (1 constraints: 0b050236) org.apache.commons:commons-lang3:3.7 (3 constraints: 751ee657) -org.apiguardian:apiguardian-api:1.1.0 (5 constraints: 0654a8a8) +org.apiguardian:apiguardian-api:1.1.0 (6 constraints: 7d64a5c6) org.awaitility:awaitility:4.0.2 (1 constraints: 08050136) org.hamcrest:hamcrest:2.1 (3 constraints: 851b6e77) org.hamcrest:hamcrest-core:2.1 (2 constraints: 720ac8bf) @@ -73,7 +73,8 @@ org.eclipse.jetty:jetty-xml:9.2.26.v20180806 (1 constraints: e70f20cb) org.junit.jupiter:junit-jupiter:5.5.0 (1 constraints: 0c051336) org.junit.jupiter:junit-jupiter-engine:5.5.0 (1 constraints: 070ed43b) org.junit.jupiter:junit-jupiter-params:5.5.0 (1 constraints: 070ed43b) -org.junit.platform:junit-platform-engine:1.5.0 (1 constraints: a6101cb4) +org.junit.platform:junit-platform-engine:1.5.0 (2 constraints: 2121d172) +org.junit.vintage:junit-vintage-engine:5.5.0 (1 constraints: 0c051336) org.mockito:mockito-core:3.9.0 (1 constraints: ec0bd6ee) org.mockito:mockito-inline:3.9.0 (1 constraints: 0e051536) org.objenesis:objenesis:3.2 (1 constraints: b10a13bd) diff --git a/versions.props b/versions.props index 6de7c805c..8e42066f6 100644 --- a/versions.props +++ b/versions.props @@ -8,6 +8,7 @@ joda-time:joda-time = 2.10.3 junit:junit = 4.13 org.hamcrest:* = 2.1 org.immutables:* = 2.8.8 +org.junit.vintage:* = 5.5.0 org.mockito:* = 3.9.0 org.slf4j:* = 1.7.12 one.util:streamex = 0.7.2