Skip to content

Commit 8c0e880

Browse files
fix: Removed dependency to Junit4 (#777)
1 parent 97ebc70 commit 8c0e880

File tree

6 files changed

+93
-4
lines changed

6 files changed

+93
-4
lines changed

applications/spring-shell/pom.xml

+6
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@
8383
<artifactId>testcontainers</artifactId>
8484
<version>${testcontainers.version}</version>
8585
<scope>test</scope>
86+
<exclusions>
87+
<exclusion>
88+
<groupId>junit</groupId>
89+
<artifactId>junit</artifactId>
90+
</exclusion>
91+
</exclusions>
8692
</dependency>
8793
<dependency>
8894
<groupId>com.rabbitmq</groupId>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2021 - 2022 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.junit.rules;
17+
18+
/**
19+
* "Fake" class used as a replacement for Junit4-dependent classes.
20+
* See more at: <a href="https://github.com/testcontainers/testcontainers-java/issues/970">
21+
* GenericContainer run from Jupiter tests shouldn't require JUnit 4.x library on runtime classpath
22+
* </a>.
23+
*/
24+
public class ExternalResource {
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright 2021 - 2022 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.junit.rules;
17+
18+
/**
19+
* "Fake" class used as a replacement for Junit4-dependent classes.
20+
* See more at: <a href="https://github.com/testcontainers/testcontainers-java/issues/970">
21+
* GenericContainer run from Jupiter tests shouldn't require JUnit 4.x library on runtime classpath
22+
* </a>.
23+
*/
24+
@SuppressWarnings("unused")
25+
public class Statement {
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright 2021 - 2022 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.junit.rules;
17+
18+
/**
19+
* "Fake" class used as a replacement for Junit4-dependent classes.
20+
* See more at: <a href="https://github.com/testcontainers/testcontainers-java/issues/970">
21+
* GenericContainer run from Jupiter tests shouldn't require JUnit 4.x library on runtime classpath
22+
* </a>.
23+
*/
24+
@SuppressWarnings("unused")
25+
public interface TestRule {
26+
}

applications/spring-shell/src/test/java/org/springframework/sbm/IntegrationTestBaseClass.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959

6060
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
6161
import static org.assertj.core.api.Assertions.assertThat;
62-
import static org.junit.Assert.fail;
62+
import static org.junit.jupiter.api.Assertions.fail;
6363

6464
/**
6565
* Base class to be extended by integrationTests.
@@ -236,16 +236,16 @@ protected void executeMavenGoals(Path executionDir, String... goals) {
236236
CommandLineException executionException = invocationResult.getExecutionException();
237237
int exitCode = invocationResult.getExitCode();
238238
if (executionException != null) {
239-
Assert.fail("Maven build 'mvn " + g
239+
fail("Maven build 'mvn " + g
240240
+ " " + pomXml + " "
241241
+ "' failed with Exception: " + executionException.getMessage());
242242
}
243243
if (exitCode != 0) {
244-
Assert.fail("Maven build 'mvn " + g
244+
fail("Maven build 'mvn " + g
245245
+ "' failed with exitCode: " + exitCode);
246246
}
247247
} catch (MavenInvocationException e) {
248-
Assert.fail("Maven build 'mvn " + g
248+
fail("Maven build 'mvn " + g
249249
+ " " + pomXml + " "
250250
+ "' failed with Exception: " + e.getMessage());
251251
e.printStackTrace();

pom.xml

+6
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@
152152
<artifactId>testcontainers</artifactId>
153153
<version>${testcontainers.version}</version>
154154
<scope>test</scope>
155+
<exclusions>
156+
<exclusion>
157+
<groupId>junit</groupId>
158+
<artifactId>junit</artifactId>
159+
</exclusion>
160+
</exclusions>
155161
</dependency>
156162
<dependency>
157163
<groupId>org.apache.maven.shared</groupId>

0 commit comments

Comments
 (0)