Files
java-tutorials/persistence-modules/spring-data-redis/src/test/java/com/baeldung/SpringContextLiveTest.java
T

34 lines
1.0 KiB
Java
Raw Normal View History

package com.baeldung;
2023-02-02 11:01:37 +02:00
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
2020-10-17 12:36:50 +03:00
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.DirtiesContext.ClassMode;
2020-10-17 12:36:50 +03:00
import com.baeldung.spring.data.redis.SpringRedisApplication;
2020-10-17 12:36:50 +03:00
import redis.embedded.RedisServerBuilder;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = SpringRedisApplication.class)
@DirtiesContext(classMode = ClassMode.BEFORE_CLASS)
2023-02-02 11:01:37 +02:00
public class SpringContextLiveTest {
2020-10-17 12:36:50 +03:00
private static redis.embedded.RedisServer redisServer;
2023-02-02 11:01:37 +02:00
@BeforeAll
2020-10-17 12:36:50 +03:00
public static void startRedisServer() {
redisServer = new RedisServerBuilder().port(6379).setting("maxmemory 256M").build();
redisServer.start();
}
2023-02-02 11:01:37 +02:00
@AfterAll
2020-10-17 12:36:50 +03:00
public static void stopRedisServer() {
redisServer.stop();
}
@Test
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
}
}