Skip to content

Commit a54047a

Browse files
committed
chore: drop junit4 dependency from :core project
1 parent 27bd893 commit a54047a

File tree

7 files changed

+12
-201
lines changed

7 files changed

+12
-201
lines changed

core/build.gradle

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,13 @@ configurations.all {
6969
}
7070

7171
dependencies {
72-
api 'junit:junit:4.13.2'
73-
api "org.junit.jupiter:junit-jupiter:5.13.0"
72+
constraints {
73+
testCompileOnly('junit:junit') {
74+
version {
75+
rejectAll()
76+
}
77+
}
78+
}
7479
api 'org.slf4j:slf4j-api:1.7.36'
7580
compileOnly 'org.jetbrains:annotations:24.1.0'
7681
testCompileOnly 'org.jetbrains:annotations:24.1.0'

core/src/main/java/org/testcontainers/containers/ComposeContainer.java

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
import lombok.NonNull;
66
import lombok.extern.slf4j.Slf4j;
77
import org.apache.commons.lang3.SystemUtils;
8-
import org.junit.runner.Description;
9-
import org.junit.runners.model.Statement;
108
import org.testcontainers.containers.output.OutputFrame;
119
import org.testcontainers.containers.wait.strategy.Wait;
1210
import org.testcontainers.containers.wait.strategy.WaitStrategy;
@@ -31,7 +29,7 @@
3129
* It uses either Compose V2 contained within the Docker binary, or a containerised version of Compose V2.
3230
*/
3331
@Slf4j
34-
public class ComposeContainer extends FailureDetectingExternalResource implements Startable {
32+
public class ComposeContainer implements Startable {
3533

3634
private final Map<String, Integer> scalingPreferences = new HashMap<>();
3735

@@ -93,32 +91,6 @@ public ComposeContainer(String identifier, List<File> composeFiles) {
9391
this.project = this.composeDelegate.getProject();
9492
}
9593

96-
@Override
97-
@Deprecated
98-
public Statement apply(Statement base, Description description) {
99-
return super.apply(base, description);
100-
}
101-
102-
@Override
103-
@Deprecated
104-
public void starting(Description description) {
105-
start();
106-
}
107-
108-
@Override
109-
@Deprecated
110-
protected void succeeded(Description description) {}
111-
112-
@Override
113-
@Deprecated
114-
protected void failed(Throwable e, Description description) {}
115-
116-
@Override
117-
@Deprecated
118-
public void finished(Description description) {
119-
stop();
120-
}
121-
12294
@Override
12395
public void start() {
12496
synchronized (MUTEX) {

core/src/main/java/org/testcontainers/containers/DockerComposeContainer.java

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
import lombok.NonNull;
66
import lombok.extern.slf4j.Slf4j;
77
import org.apache.commons.lang3.SystemUtils;
8-
import org.junit.runner.Description;
9-
import org.junit.runners.model.Statement;
108
import org.testcontainers.containers.output.OutputFrame;
119
import org.testcontainers.containers.wait.strategy.Wait;
1210
import org.testcontainers.containers.wait.strategy.WaitStrategy;
@@ -31,7 +29,7 @@
3129
*/
3230
@Slf4j
3331
public class DockerComposeContainer<SELF extends DockerComposeContainer<SELF>>
34-
extends FailureDetectingExternalResource
32+
3533
implements Startable {
3634

3735
private final Map<String, Integer> scalingPreferences = new HashMap<>();
@@ -99,32 +97,6 @@ public DockerComposeContainer(String identifier, List<File> composeFiles) {
9997
this.project = this.composeDelegate.getProject();
10098
}
10199

102-
@Override
103-
@Deprecated
104-
public Statement apply(Statement base, Description description) {
105-
return super.apply(base, description);
106-
}
107-
108-
@Override
109-
@Deprecated
110-
public void starting(Description description) {
111-
start();
112-
}
113-
114-
@Override
115-
@Deprecated
116-
protected void succeeded(Description description) {}
117-
118-
@Override
119-
@Deprecated
120-
protected void failed(Throwable e, Description description) {}
121-
122-
@Override
123-
@Deprecated
124-
public void finished(Description description) {
125-
stop();
126-
}
127-
128100
@Override
129101
public void start() {
130102
synchronized (MUTEX) {

core/src/main/java/org/testcontainers/containers/FailureDetectingExternalResource.java

Lines changed: 0 additions & 50 deletions
This file was deleted.

core/src/main/java/org/testcontainers/containers/GenericContainer.java

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232
import org.apache.commons.lang3.SystemUtils;
3333
import org.jetbrains.annotations.NotNull;
3434
import org.jetbrains.annotations.Nullable;
35-
import org.junit.runner.Description;
36-
import org.junit.runners.model.Statement;
3735
import org.rnorth.ducttape.unreliables.Unreliables;
3836
import org.slf4j.Logger;
3937
import org.testcontainers.DockerClientFactory;
@@ -106,7 +104,7 @@
106104
*/
107105
@Data
108106
public class GenericContainer<SELF extends GenericContainer<SELF>>
109-
extends FailureDetectingExternalResource
107+
110108
implements Container<SELF>, AutoCloseable, WaitStrategyTarget, Startable {
111109

112110
public static final int CONTAINER_RUNNING_TIMEOUT_SEC = 30;
@@ -1053,57 +1051,6 @@ public void addExposedPorts(int... ports) {
10531051
this.containerDef.addExposedTcpPorts(ports);
10541052
}
10551053

1056-
private TestDescription toDescription(Description description) {
1057-
return new TestDescription() {
1058-
@Override
1059-
public String getTestId() {
1060-
return description.getDisplayName();
1061-
}
1062-
1063-
@Override
1064-
public String getFilesystemFriendlyName() {
1065-
return description.getClassName() + "-" + description.getMethodName();
1066-
}
1067-
};
1068-
}
1069-
1070-
@Override
1071-
@Deprecated
1072-
public Statement apply(Statement base, Description description) {
1073-
return super.apply(base, description);
1074-
}
1075-
1076-
@Override
1077-
@Deprecated
1078-
protected void starting(Description description) {
1079-
if (this instanceof TestLifecycleAware) {
1080-
((TestLifecycleAware) this).beforeTest(toDescription(description));
1081-
}
1082-
this.start();
1083-
}
1084-
1085-
@Override
1086-
@Deprecated
1087-
protected void succeeded(Description description) {
1088-
if (this instanceof TestLifecycleAware) {
1089-
((TestLifecycleAware) this).afterTest(toDescription(description), Optional.empty());
1090-
}
1091-
}
1092-
1093-
@Override
1094-
@Deprecated
1095-
protected void failed(Throwable e, Description description) {
1096-
if (this instanceof TestLifecycleAware) {
1097-
((TestLifecycleAware) this).afterTest(toDescription(description), Optional.of(e));
1098-
}
1099-
}
1100-
1101-
@Override
1102-
@Deprecated
1103-
protected void finished(Description description) {
1104-
this.stop();
1105-
}
1106-
11071054
/**
11081055
* {@inheritDoc}
11091056
*/

core/src/main/java/org/testcontainers/containers/Network.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
import lombok.Builder;
55
import lombok.Getter;
66
import lombok.Singular;
7-
import org.junit.rules.ExternalResource;
8-
import org.junit.rules.TestRule;
97
import org.testcontainers.DockerClientFactory;
108
import org.testcontainers.utility.ResourceReaper;
119

@@ -17,7 +15,7 @@
1715
import java.util.concurrent.atomic.AtomicBoolean;
1816
import java.util.function.Consumer;
1917

20-
public interface Network extends AutoCloseable, TestRule {
18+
public interface Network extends AutoCloseable {
2119
Network SHARED = new NetworkImpl(false, null, Collections.emptySet(), null) {
2220
@Override
2321
public void close() {
@@ -40,7 +38,7 @@ static NetworkImpl.NetworkImplBuilder builder() {
4038

4139
@Builder
4240
@Getter
43-
class NetworkImpl extends ExternalResource implements Network {
41+
class NetworkImpl implements Network {
4442

4543
private final String name = UUID.randomUUID().toString();
4644

@@ -100,11 +98,6 @@ private String create() {
10098
return createNetworkCmd.exec().getId();
10199
}
102100

103-
@Override
104-
protected void after() {
105-
close();
106-
}
107-
108101
@Override
109102
public synchronized void close() {
110103
if (initialized.getAndSet(false)) {

core/src/test/java/org/testcontainers/containers/FailureDetectingExternalResourceTest.java

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)