Convert buildSrc to JUnit 5

Closes gh-9467
This commit is contained in:
Rob Winch
2021-07-09 16:36:26 -05:00
parent 5cf40ab9da
commit c173e801c5
27 changed files with 465 additions and 604 deletions

View File

@@ -0,0 +1,58 @@
/*
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package io.spring.gradle;
import org.apache.commons.io.FileUtils;
import org.gradle.testkit.runner.GradleRunner;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Paths;
import java.util.Enumeration;
public class TestKit {
final File buildDir;
public TestKit(File buildDir) {
this.buildDir = buildDir;
}
public File getRootDir() {
return buildDir;
}
public GradleRunner withProjectDir(File projectDir) throws IOException {
FileUtils.copyDirectory(projectDir, buildDir);
return GradleRunner.create()
.withProjectDir(buildDir)
.withPluginClasspath();
}
public GradleRunner withProjectResource(String projectResourceName) throws IOException, URISyntaxException {
ClassLoader classLoader = getClass().getClassLoader();
Enumeration<URL> resources = classLoader.getResources(projectResourceName);
if(!resources.hasMoreElements()) {
throw new IOException("Cannot find resource " + projectResourceName + " with " + classLoader);
}
URL resourceUrl = resources.nextElement();
File projectDir = Paths.get(resourceUrl.toURI()).toFile();
return withProjectDir(projectDir);
}
}

View File

@@ -0,0 +1,31 @@
package io.spring.gradle.convention;
import io.spring.gradle.TestKit;
import org.gradle.testkit.runner.BuildResult;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import java.nio.file.Path;
import static org.assertj.core.api.Assertions.assertThat;
import static org.gradle.testkit.runner.TaskOutcome.SUCCESS;
public class DependencySetPluginITest {
private TestKit testKit;
@BeforeEach
void setup(@TempDir Path tempDir) {
this.testKit = new TestKit(tempDir.toFile());
}
@Test
public void dependencies() throws Exception {
BuildResult result = testKit.withProjectResource("samples/dependencyset")
.withArguments("dependencies")
.build();
assertThat(result.task(":dependencies").getOutcome()).isEqualTo(SUCCESS);
assertThat(result.getOutput()).doesNotContain("FAILED");
}
}

View File

@@ -0,0 +1,85 @@
package io.spring.gradle.convention;
import io.spring.gradle.TestKit;
import org.codehaus.groovy.runtime.ResourceGroovyMethods;
import org.gradle.testkit.runner.BuildResult;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import java.io.File;
import java.nio.file.Path;
import java.util.Collections;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import static org.assertj.core.api.Assertions.assertThat;
import static org.gradle.testkit.runner.TaskOutcome.FAILED;
import static org.gradle.testkit.runner.TaskOutcome.SUCCESS;
public class DocsPluginITest {
private TestKit testKit;
@BeforeEach
void setup(@TempDir Path tempDir) {
this.testKit = new TestKit(tempDir.toFile());
}
@Test
public void buildTriggersDocs() throws Exception {
BuildResult result = testKit.withProjectResource("samples/docs/simple/")
.withArguments("build")
.build();
assertThat(result.task(":build").getOutcome()).isEqualTo(SUCCESS);
assertThat(result.task(":docs").getOutcome()).isEqualTo(SUCCESS);
assertThat(result.task(":docsZip").getOutcome()).isEqualTo(SUCCESS);
File zip = new File(testKit.getRootDir(), "build/distributions/simple-1.0.0.BUILD-SNAPSHOT-docs.zip");
List<? extends ZipEntry> entries = Collections.list(new ZipFile(zip).entries());
assertThat(entries)
.extracting(ZipEntry::getName)
.contains("docs/reference/html5/index.html")
.contains("docs/reference/pdf/simple-reference.pdf");
}
@Test
public void asciidocCopiesImages() throws Exception {
BuildResult result = testKit.withProjectResource("samples/docs/simple/").withArguments("asciidoctor").build();
assertThat(result.task(":asciidoctor").getOutcome()).isEqualTo(SUCCESS);
assertThat(new File(testKit.getRootDir(), "build/docs/asciidoc/images")).exists();
}
@Test
public void asciidocDocInfoFromResourcesUsed() throws Exception {
BuildResult result = this.testKit.withProjectResource("samples/docs/simple/")
.withArguments("asciidoctor")
.build();
assertThat(result.task(":asciidoctor").getOutcome()).isEqualTo(SUCCESS);
assertThat(ResourceGroovyMethods.getText(new File(testKit.getRootDir(), "build/docs/asciidoc/index.html")))
.contains("<script type=\"text/javascript\" src=\"js/tocbot/tocbot.min.js\"></script>");
}
@Test
public void missingAttributeFails() throws Exception {
BuildResult result = this.testKit.withProjectResource("samples/docs/missing-attribute/")
.withArguments(":asciidoctor")
.buildAndFail();
assertThat(result.task(":asciidoctor").getOutcome()).isEqualTo(FAILED);
}
@Test
public void missingInclude() throws Exception {
BuildResult result = this.testKit.withProjectResource("samples/docs/missing-include/")
.withArguments(":asciidoctor")
.buildAndFail();
assertThat(result.task(":asciidoctor").getOutcome()).isEqualTo(FAILED);
}
@Test
public void missingCrossReference() throws Exception {
BuildResult result = this.testKit.withProjectResource("samples/docs/missing-cross-reference/")
.withArguments(":asciidoctor")
.buildAndFail();
assertThat(result.task(":asciidoctor").getOutcome()).isEqualTo(FAILED);
}
}

View File

@@ -19,10 +19,9 @@ package io.spring.gradle.convention;
import org.apache.commons.io.FileUtils;
import org.gradle.api.Project;
import org.gradle.api.plugins.JavaPlugin;
import org.gradle.api.tasks.javadoc.Javadoc;
import org.gradle.testfixtures.ProjectBuilder;
import org.junit.After;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import java.io.File;
@@ -34,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class IntegrationPluginTest {
Project rootProject;
@After
@AfterEach
public void cleanup() throws Exception {
if (rootProject != null) {
FileUtils.deleteDirectory(rootProject.getProjectDir());

View File

@@ -0,0 +1,52 @@
package io.spring.gradle.convention;
import io.spring.gradle.TestKit;
import org.gradle.testkit.runner.BuildResult;
import org.gradle.testkit.runner.TaskOutcome;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.io.TempDir;
import java.io.File;
import java.nio.file.Path;
import static org.assertj.core.api.Assertions.assertThat;
public class IntegrationTestPluginITest {
private io.spring.gradle.TestKit testKit;
@BeforeEach
void setup(@TempDir Path tempDir) {
this.testKit = new TestKit(tempDir.toFile());
}
@Test
public void checkWithJavaPlugin() throws Exception {
BuildResult result = this.testKit.withProjectResource("samples/integrationtest/withjava/")
.withArguments("check")
.build();
assertThat(result.task(":check").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
assertThat(new File(testKit.getRootDir(), "build/test-results/integrationTest/")).exists();
assertThat(new File(testKit.getRootDir(), "build/reports/tests/integrationTest/")).exists();
}
@Test
public void checkWithPropdeps() throws Exception {
BuildResult result = this.testKit.withProjectResource("samples/integrationtest/withpropdeps/")
.withArguments("check")
.build();
assertThat(result.task(":check").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
assertThat(new File(testKit.getRootDir(), "build/test-results/integrationTest/")).exists();
assertThat(new File(testKit.getRootDir(), "build/reports/tests/integrationTest/")).exists();
}
@Test
public void checkWithGroovy() throws Exception {
BuildResult result = this.testKit.withProjectResource("samples/integrationtest/withgroovy/")
.withArguments("check")
.build();
assertThat(result.task(":check").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
assertThat(new File(testKit.getRootDir(), "build/test-results/integrationTest/")).exists();
assertThat(new File(testKit.getRootDir(), "build/reports/tests/integrationTest/")).exists();
}
}

View File

@@ -0,0 +1,31 @@
package io.spring.gradle.convention;
import org.gradle.testkit.runner.BuildResult;
import org.gradle.testkit.runner.TaskOutcome;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.io.TempDir;
import java.io.File;
import java.nio.file.Path;
import static org.assertj.core.api.Assertions.assertThat;
public class JacocoPluginITest{
private io.spring.gradle.TestKit testKit;
@BeforeEach
void setup(@TempDir Path tempDir) {
this.testKit = new io.spring.gradle.TestKit(tempDir.toFile());
}
@Test
public void checkWithJavaPlugin() throws Exception {
BuildResult result = this.testKit.withProjectResource("samples/jacoco/java/")
.withArguments("check")
.build();
assertThat(result.task(":check").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
assertThat(new File(testKit.getRootDir(), "build/jacoco")).exists();
assertThat(new File(testKit.getRootDir(), "build/reports/jacoco/test/html/")).exists();
}
}

View File

@@ -0,0 +1,38 @@
package io.spring.gradle.convention;
import io.spring.gradle.TestKit;
import org.apache.commons.io.FileUtils;
import org.gradle.testkit.runner.BuildResult;
import org.gradle.testkit.runner.TaskOutcome;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import java.io.File;
import java.nio.file.Path;
import static org.assertj.core.api.Assertions.assertThat;
public class JavadocApiPluginITest {
private TestKit testKit;
@BeforeEach
void setup(@TempDir Path tempDir) {
this.testKit = new TestKit(tempDir.toFile());
}
@Test
public void multiModuleApi() throws Exception {
BuildResult result = this.testKit.withProjectResource("samples/javadocapi/multimodule/")
.withArguments("api")
.build();
assertThat(result.task(":api").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
File allClasses = new File(testKit.getRootDir(), "build/api/allclasses-noframe.html");
File index = new File(testKit.getRootDir(), "build/api/allclasses.html");
File listing = allClasses.exists() ? allClasses : index;
String listingText = FileUtils.readFileToString(listing);
assertThat(listingText).contains("sample/Api.html");
assertThat(listingText).contains("sample/Impl.html");
assertThat(listingText).doesNotContain("sample/Sample.html");
}
}

View File

@@ -23,8 +23,8 @@ import static org.assertj.core.api.Assertions.assertThat;
import org.gradle.api.Project;
import org.gradle.api.tasks.javadoc.Javadoc;
import org.gradle.testfixtures.ProjectBuilder;
import org.junit.After;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
/**
* @author Rob Winch
@@ -32,7 +32,7 @@ import org.junit.Test;
public class JavadocApiPluginTest {
Project rootProject;
@After
@AfterEach
public void cleanup() throws Exception {
if (rootProject != null) {
FileUtils.deleteDirectory(rootProject.getProjectDir());

View File

@@ -22,8 +22,8 @@ import org.gradle.api.artifacts.repositories.ArtifactRepository;
import org.gradle.api.artifacts.repositories.MavenArtifactRepository;
import org.gradle.api.plugins.ExtraPropertiesExtension;
import org.gradle.testfixtures.ProjectBuilder;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
@@ -34,7 +34,7 @@ public class RepositoryConventionPluginTests {
private Project project = ProjectBuilder.builder().build();
@Before
@BeforeEach
public void setUp() {
this.project.getProperties().clear();
}

View File

@@ -0,0 +1,71 @@
package io.spring.gradle.convention;
import io.spring.gradle.TestKit;
import org.codehaus.groovy.runtime.ResourceGroovyMethods;
import org.gradle.testkit.runner.BuildResult;
import org.gradle.testkit.runner.TaskOutcome;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import static org.assertj.core.api.Assertions.assertThat;
public class ShowcaseITest {
private TestKit testKit;
@BeforeEach
void setup(@TempDir Path tempDir) {
this.testKit = new TestKit(tempDir.toFile());
}
@Test
public void build() throws Exception {
BuildResult result = this.testKit.withProjectResource("samples/showcase/")
.withArguments("build", "--stacktrace")
.forwardOutput()
.build();
assertThat(result.getOutput()).contains("BUILD SUCCESSFUL");
}
@Test
@Disabled
public void install() throws Exception {
BuildResult result = this.testKit
.withProjectResource("samples/showcase/")
.withArguments("install", "--stacktrace")
.build();
assertThat(result.getOutput()).contains("SUCCESS");
File pom = new File(testKit.getRootDir(), "sgbcs-core/build/poms/pom-default.xml");
assertThat(pom).exists();
String pomText = new String(Files.readAllBytes(pom.toPath()));
String pomTextNoSpace = pomText.replaceAll("\\s", "");
assertThat(pomText).doesNotContain("<dependencyManagement>");
assertThat(pomTextNoSpace).contains("<dependency>\n <groupId>org.springframework</groupId>\n <artifactId>spring-test</artifactId>\n <scope>test</scope>\n <version>4.3.6.RELEASE</version>\n </dependency>".replaceAll("\\s", ""));
assertThat(pomTextNoSpace).contains("<developers>\n <developer>\n <id>rwinch</id>\n <name>Rob Winch</name>\n <email>rwinch@pivotal.io</email>\n </developer>\n <developer>\n <id>jgrandja</id>\n <name>Joe Grandja</name>\n <email>jgrandja@pivotal.io</email>\n </developer>\n </developers>".replaceAll("\\s", ""));
assertThat(pomTextNoSpace).contains("<scm>\n <connection>scm:git:git://github.com/spring-projects/spring-security</connection>\n <developerConnection>scm:git:git://github.com/spring-projects/spring-security</developerConnection>\n <url>https://github.com/spring-projects/spring-security</url>\n </scm>".replaceAll("\\s", ""));
assertThat(pomTextNoSpace).contains("<description>sgbcs-core</description>");
assertThat(pomTextNoSpace).contains("<url>https://spring.io/spring-security</url>");
assertThat(pomTextNoSpace).contains("<organization>\n <name>spring.io</name>\n <url>https://spring.io/</url>\n </organization>".replaceAll("\\s", ""));
assertThat(pomTextNoSpace).contains(" <licenses>\n <license>\n <name>The Apache Software License, Version 2.0</name>\n <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>\n <distribution>repo</distribution>\n </license>\n </licenses>".replaceAll("\\s", ""));
assertThat(pomTextNoSpace).contains("<scm>\n <connection>scm:git:git://github.com/spring-projects/spring-security</connection>\n <developerConnection>scm:git:git://github.com/spring-projects/spring-security</developerConnection>\n <url>https://github.com/spring-projects/spring-security</url>\n </scm>".replaceAll("\\s", ""));
File bom = new File(testKit.getRootDir(), "bom/build/poms/pom-default.xml");
assertThat(bom).exists();
assertThat(bom).hasContent("<artifactId>sgbcs-core</artifactId>");
BuildResult secondBuild = this.testKit.withProjectResource("samples/showcase/").withArguments("mavenBom", "--stacktrace").build();
// mavenBom is not up to date since install is never up to date
assertThat(result.task(":bom:mavenBom").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
}
}

View File

@@ -0,0 +1,74 @@
package io.spring.gradle.convention;
import io.spring.gradle.TestKit;
import org.apache.commons.io.IOUtils;
import org.gradle.testkit.runner.BuildResult;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.LinkedHashMap;
import static org.assertj.core.api.Assertions.assertThat;
public class SpringMavenPluginITest {
private TestKit testKit;
@BeforeEach
void setup(@TempDir Path tempDir) {
this.testKit = new TestKit(tempDir.toFile());
}
@Disabled
@Test
public void install() throws Exception {
BuildResult result = this.testKit.withProjectResource("samples/maven/install")
.withArguments("install")
.build();
assertThat(result.getOutput()).contains("SUCCESS");
File pom = new File(testKit.getRootDir(), "build/poms/pom-default.xml");
assertThat(pom).exists();
String pomText = new String(Files.readAllBytes(pom.toPath()));
assertThat(pomText.replaceAll("\\s", "")).contains("<dependency>\n <groupId>aopalliance</groupId>\n <artifactId>aopalliance</artifactId>\n <version>1.0</version>\n <scope>compile</scope>\n <optional>true</optional>\n </dependency>".replaceAll("\\s", ""));
}
@Disabled
@Test
public void signArchivesWhenInMemory() throws Exception {
LinkedHashMap<String, String> map = new LinkedHashMap<String, String>(2);
map.put("ORG_GRADLE_PROJECT_signingKey", getSigningKey());
map.put("ORG_GRADLE_PROJECT_signingPassword", "password");
BuildResult result = this.testKit.withProjectResource("samples/maven/signing")
.withArguments("signArchives")
.withEnvironment(map)
.forwardOutput()
.build();
assertThat(result.getOutput()).contains("SUCCESS");
final File jar = new File(testKit.getRootDir(), "build/libs/signing-1.0.0.RELEASE.jar");
assertThat(jar).exists();
File signature = new File(jar.getAbsolutePath() + ".asc");
assertThat(signature).exists();
}
@Test
public void upload() throws Exception {
BuildResult result = this.testKit.withProjectResource("samples/maven/upload")
.withArguments("uploadArchives")
.forwardOutput()
.build();
assertThat(result.getOutput()).contains("SUCCESS");
File pom = new File(testKit.getRootDir(), "build/poms/pom-default.xml");
assertThat(pom).exists();
String pomText = new String(Files.readAllBytes(pom.toPath()));
assertThat(pomText.replaceAll("\\s", "")).contains("<dependency>\n <groupId>aopalliance</groupId>\n <artifactId>aopalliance</artifactId>\n <version>1.0</version>\n <scope>compile</scope>\n <optional>true</optional>\n </dependency>".replaceAll("\\s", ""));
}
public String getSigningKey() throws Exception {
return IOUtils.toString(getClass().getResource("/test-private.pgp"));
}
}

View File

@@ -0,0 +1,31 @@
package io.spring.gradle.convention;
import io.spring.gradle.TestKit;
import org.gradle.testkit.runner.BuildResult;
import org.gradle.testkit.runner.TaskOutcome;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import java.nio.file.Path;
import static org.assertj.core.api.Assertions.assertThat;
public class TestsConfigurationPluginITest {
private TestKit testKit;
@BeforeEach
void setup(@TempDir Path tempDir) {
this.testKit = new TestKit(tempDir.toFile());
}
@Test
public void canFindDepencency() throws Exception {
BuildResult result = this.testKit.withProjectResource("samples/testsconfiguration")
.withArguments("check")
.build();
assertThat(result.task(":web:check").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
}
}

View File

@@ -5,26 +5,21 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.when;
import org.gradle.api.Project;
import org.junit.Before;
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.junit.MockitoJUnitRunner;
import org.mockito.junit.jupiter.MockitoExtension;
@RunWith(MockitoJUnitRunner.class)
@ExtendWith(MockitoExtension.class)
public class UtilsTest {
@Mock
Project project;
@Mock
Project rootProject;
@Before
public void setup() {
when(project.getRootProject()).thenReturn(rootProject);
}
@Test
public void getProjectName() {
when(project.getRootProject()).thenReturn(rootProject);
when(rootProject.getName()).thenReturn("spring-security");
assertThat(Utils.getProjectName(project)).isEqualTo("spring-security");
@@ -32,6 +27,7 @@ public class UtilsTest {
@Test
public void getProjectNameWhenEndsWithBuildThenStrippedOut() {
when(project.getRootProject()).thenReturn(rootProject);
when(rootProject.getName()).thenReturn("spring-security-build");
assertThat(Utils.getProjectName(project)).isEqualTo("spring-security");

View File

@@ -19,9 +19,9 @@ package io.spring.gradle.convention.sagan;
import okhttp3.mockwebserver.MockResponse;
import okhttp3.mockwebserver.MockWebServer;
import okhttp3.mockwebserver.RecordedRequest;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.gradle.sagan.Release;
import org.springframework.gradle.sagan.SaganApi;
@@ -38,7 +38,7 @@ public class SaganApiTests {
private String baseUrl;
@Before
@BeforeEach
public void setup() throws Exception {
this.server = new MockWebServer();
this.server.start();
@@ -47,7 +47,7 @@ public class SaganApiTests {
this.sagan.setBaseUrl(this.baseUrl);
}
@After
@AfterEach
public void cleanup() throws Exception {
this.server.shutdown();
}

View File

@@ -3,9 +3,9 @@ package io.spring.gradle.github.milestones;
import okhttp3.mockwebserver.MockResponse;
import okhttp3.mockwebserver.MockWebServer;
import okhttp3.mockwebserver.RecordedRequest;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.gradle.github.milestones.GitHubMilestoneApi;
import org.springframework.gradle.github.milestones.RepositoryRef;
@@ -24,7 +24,7 @@ public class GitHubMilestoneApiTests {
private String baseUrl;
@Before
@BeforeEach
public void setup() throws Exception {
this.server = new MockWebServer();
this.server.start();
@@ -33,7 +33,7 @@ public class GitHubMilestoneApiTests {
this.github.setBaseUrl(this.baseUrl);
}
@After
@AfterEach
public void cleanup() throws Exception {
this.server.shutdown();
}

View File

@@ -3,9 +3,9 @@ package org.springframework.gradle.github.milestones;
import okhttp3.mockwebserver.MockResponse;
import okhttp3.mockwebserver.MockWebServer;
import okhttp3.mockwebserver.RecordedRequest;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.concurrent.TimeUnit;
@@ -22,7 +22,7 @@ public class GitHubMilestoneApiTests {
private String baseUrl;
@Before
@BeforeEach
public void setup() throws Exception {
this.server = new MockWebServer();
this.server.start();
@@ -31,7 +31,7 @@ public class GitHubMilestoneApiTests {
this.github.setBaseUrl(this.baseUrl);
}
@After
@AfterEach
public void cleanup() throws Exception {
this.server.shutdown();
}

View File

@@ -20,10 +20,9 @@ import com.github.benmanes.gradle.versions.updates.resolutionstrategy.ComponentS
import org.gradle.api.Action;
import org.gradle.api.artifacts.ComponentSelection;
import org.gradle.api.artifacts.component.ModuleComponentIdentifier;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.util.Collections;
import java.util.List;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;

View File

@@ -17,7 +17,7 @@
package org.springframework.security.convention.versions;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;