Merge pull request #13412 from eugenp/build-error

update tests to use junit5, mark live test
This commit is contained in:
Loredana Crusoveanu 2023-02-02 11:09:54 +02:00 committed by GitHub
commit 3d1184b69c
3 changed files with 7 additions and 12 deletions

View File

@ -42,11 +42,6 @@
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>cglib</groupId> <groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId> <artifactId>cglib-nodep</artifactId>

View File

@ -1,8 +1,8 @@
package com.baeldung; package com.baeldung;
import org.junit.AfterClass; import org.junit.jupiter.api.AfterAll;
import org.junit.BeforeClass; import org.junit.jupiter.api.BeforeAll;
import org.junit.Test; import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.DirtiesContext.ClassMode; import org.springframework.test.annotation.DirtiesContext.ClassMode;
@ -13,17 +13,17 @@ import redis.embedded.RedisServerBuilder;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = SpringRedisApplication.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = SpringRedisApplication.class)
@DirtiesContext(classMode = ClassMode.BEFORE_CLASS) @DirtiesContext(classMode = ClassMode.BEFORE_CLASS)
public class SpringContextTest { public class SpringContextLiveTest {
private static redis.embedded.RedisServer redisServer; private static redis.embedded.RedisServer redisServer;
@BeforeClass @BeforeAll
public static void startRedisServer() { public static void startRedisServer() {
redisServer = new RedisServerBuilder().port(6379).setting("maxmemory 256M").build(); redisServer = new RedisServerBuilder().port(6379).setting("maxmemory 256M").build();
redisServer.start(); redisServer.start();
} }
@AfterClass @AfterAll
public static void stopRedisServer() { public static void stopRedisServer() {
redisServer.stop(); redisServer.stop();
} }

View File

@ -89,7 +89,7 @@
<configuration> <configuration>
<packageName>com.baeldung</packageName> <packageName>com.baeldung</packageName>
<sources> <sources>
<source>src/main/resources/products.xsd</source> <source>${project.basedir}/src/main/resources/products.xsd</source>
</sources> </sources>
</configuration> </configuration>