changes related to spring-boot-modules/spring-boot-testing boot 2.4.0 upgrade

This commit is contained in:
Gerardo Roza 2021-01-13 11:28:41 -03:00
parent 1a0655a189
commit 1ed7c56596
4 changed files with 21 additions and 6 deletions

View File

@ -51,6 +51,17 @@
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Embedded Redis Server --> <!-- Embedded Redis Server -->
<dependency> <dependency>

View File

@ -7,13 +7,13 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.context.ConfigFileApplicationContextInitializer; import org.springframework.boot.test.context.ConfigDataApplicationContextInitializer;
import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.junit.jupiter.SpringExtension;
@ExtendWith(SpringExtension.class) @ExtendWith(SpringExtension.class)
@ContextConfiguration(initializers = ConfigFileApplicationContextInitializer.class) @ContextConfiguration(initializers = ConfigDataApplicationContextInitializer.class)
@EnableConfigurationProperties(value = ServerConfig.class) @EnableConfigurationProperties(value = ServerConfig.class)
@ActiveProfiles("test") @ActiveProfiles("test")
public class BindingYMLPropertiesUnitTest { public class BindingYMLPropertiesUnitTest {

View File

@ -4,7 +4,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.boot.ApplicationRunner; import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.CommandLineRunner; import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.test.context.ConfigFileApplicationContextInitializer; import org.springframework.boot.test.context.ConfigDataApplicationContextInitializer;
import org.springframework.boot.test.mock.mockito.SpyBean; import org.springframework.boot.test.mock.mockito.SpyBean;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.junit.jupiter.SpringExtension;
@ -19,7 +19,7 @@ import static org.mockito.Mockito.verify;
@ExtendWith(SpringExtension.class) @ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = { ApplicationCommandLineRunnerApp.class }, @ContextConfiguration(classes = { ApplicationCommandLineRunnerApp.class },
initializers = ConfigFileApplicationContextInitializer.class) initializers = ConfigDataApplicationContextInitializer.class)
public class LoadSpringContextIntegrationTest { public class LoadSpringContextIntegrationTest {
@SpyBean @SpyBean
TaskService taskService; TaskService taskService;

View File

@ -1,5 +1,7 @@
spring: spring:
profiles: test config:
activate:
on-profile: test
server: server:
address: address:
ip: 192.168.0.4 ip: 192.168.0.4
@ -7,7 +9,9 @@ server:
imgs: /etc/test/imgs imgs: /etc/test/imgs
--- ---
spring: spring:
profiles: dev config:
activate:
on-profile: dev
server: server:
address: address:
ip: 192.168.0.5 ip: 192.168.0.5