mirror of
https://gitee.com/dcren/initializr.git
synced 2025-09-18 17:48:14 +08:00
Migrate tests to JUnit5
See gh-802
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>io.spring.initializr</groupId>
|
||||
@@ -52,10 +53,20 @@
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@@ -22,7 +22,7 @@ import java.util.List;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import io.spring.initializr.web.AbstractFullStackInitializrIntegrationTests;
|
||||
import io.spring.initializr.web.AbstractInitializrIntegrationTests.Config;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
|
@@ -19,7 +19,7 @@ package io.spring.initializr.actuate.autoconfigure;
|
||||
import io.spring.initializr.actuate.info.BomRangesInfoContributor;
|
||||
import io.spring.initializr.actuate.info.DependencyRangesInfoContributor;
|
||||
import io.spring.initializr.web.autoconfigure.InitializrAutoConfiguration;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
|
||||
|
@@ -18,7 +18,7 @@ package io.spring.initializr.actuate.autoconfigure;
|
||||
|
||||
import io.micrometer.core.instrument.MeterRegistry;
|
||||
import io.spring.initializr.actuate.metric.ProjectGenerationMetricsListener;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.metrics.CompositeMeterRegistryAutoConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration;
|
||||
|
@@ -19,7 +19,7 @@ package io.spring.initializr.actuate.autoconfigure;
|
||||
import io.spring.initializr.actuate.stat.ProjectGenerationStatPublisher;
|
||||
import io.spring.initializr.metadata.InitializrMetadataProvider;
|
||||
import io.spring.initializr.web.autoconfigure.InitializrAutoConfiguration;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
|
@@ -22,7 +22,7 @@ import io.spring.initializr.metadata.BillOfMaterials;
|
||||
import io.spring.initializr.metadata.InitializrMetadata;
|
||||
import io.spring.initializr.metadata.SimpleInitializrMetadataProvider;
|
||||
import io.spring.initializr.test.metadata.InitializrMetadataTestBuilder;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.actuate.info.Info;
|
||||
|
||||
|
@@ -23,7 +23,7 @@ import io.spring.initializr.metadata.Dependency;
|
||||
import io.spring.initializr.metadata.InitializrMetadata;
|
||||
import io.spring.initializr.metadata.SimpleInitializrMetadataProvider;
|
||||
import io.spring.initializr.test.metadata.InitializrMetadataTestBuilder;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.actuate.info.Info;
|
||||
|
||||
|
@@ -26,8 +26,8 @@ import io.spring.initializr.generator.ProjectRequest;
|
||||
import io.spring.initializr.metadata.Dependency;
|
||||
import io.spring.initializr.metadata.InitializrMetadata;
|
||||
import io.spring.initializr.test.metadata.InitializrMetadataTestBuilder;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* @author Stephane Nicoll
|
||||
@@ -41,7 +41,7 @@ public class ProjectGenerationMetricsListenerTests {
|
||||
|
||||
private MetricsAssert metricsAssert;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
SimpleMeterRegistry meterRegistry = new SimpleMeterRegistry();
|
||||
this.listener = new ProjectGenerationMetricsListener(meterRegistry);
|
||||
|
@@ -23,8 +23,8 @@ import java.util.List;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import io.spring.initializr.actuate.stat.MainControllerStatsIntegrationTests.StatsMockController;
|
||||
import io.spring.initializr.web.AbstractFullStackInitializrIntegrationTests;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Import;
|
||||
@@ -56,7 +56,7 @@ public class MainControllerStatsIntegrationTests
|
||||
@Autowired
|
||||
private ProjectGenerationStatPublisher projectGenerationStatPublisher;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
this.statsMockController.stats.clear();
|
||||
// Make sure our mock is going to be invoked with the stats
|
||||
|
@@ -22,8 +22,8 @@ import java.util.UUID;
|
||||
import io.spring.initializr.actuate.stat.StatsProperties.Elastic;
|
||||
import io.spring.initializr.generator.ProjectGeneratedEvent;
|
||||
import io.spring.initializr.generator.ProjectRequest;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.web.client.RestTemplateBuilder;
|
||||
import org.springframework.http.HttpMethod;
|
||||
@@ -54,7 +54,7 @@ public class ProjectGenerationStatPublisherTests extends AbstractInitializrStatT
|
||||
|
||||
private MockRestServiceServer mockServer;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
configureService(createProperties());
|
||||
}
|
||||
|
@@ -21,7 +21,7 @@ import java.util.Arrays;
|
||||
import io.spring.initializr.generator.ProjectFailedEvent;
|
||||
import io.spring.initializr.generator.ProjectGeneratedEvent;
|
||||
import io.spring.initializr.generator.ProjectRequest;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
package io.spring.initializr.actuate.stat;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
Reference in New Issue
Block a user