Makes junit:junit optional.

This means modules using spring-cloud-test-support must have the
junit-vintage-engine dependency so tests will run properly.
This commit is contained in:
spencergibb
2021-03-09 14:45:22 -05:00
parent 458ba95507
commit 2b2903c91d
5 changed files with 26 additions and 0 deletions

View File

@@ -60,6 +60,11 @@
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>

View File

@@ -42,6 +42,11 @@
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>

View File

@@ -117,5 +117,10 @@
<artifactId>awaitility</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@@ -18,7 +18,9 @@ package org.springframework.cloud.loadbalancer.security;
import java.net.URI;
import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -51,6 +53,14 @@ public class OAuth2LoadBalancerClientAutoConfigurationTests {
@Rule
public ExpectedException expected = ExpectedException.none();
@Before
public void before() {
// FIXME: why do I need to do this? (fails in maven build without it.
// https://stackoverflow.com/questions/28911560/tomcat-8-embedded-error-org-apache-catalina-core-containerbase-a-child-con
// https://github.com/spring-projects/spring-boot/issues/21535
TomcatURLStreamHandlerFactory.disable();
}
@After
public void close() {
if (this.context != null) {

View File

@@ -54,6 +54,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework</groupId>