2020-02-12 19:55:28 +01:00
|
|
|
package com.baeldung;
|
2019-10-31 20:43:47 -05:00
|
|
|
|
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;
|
2019-10-31 20:43:47 -05:00
|
|
|
|
2020-10-17 12:36:50 +03:00
|
|
|
import com.baeldung.spring.data.redis.SpringRedisApplication;
|
2019-10-31 20:43:47 -05:00
|
|
|
|
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();
|
|
|
|
|
}
|
2019-10-31 20:43:47 -05:00
|
|
|
|
2023-02-02 11:01:37 +02:00
|
|
|
@AfterAll
|
2020-10-17 12:36:50 +03:00
|
|
|
public static void stopRedisServer() {
|
|
|
|
|
redisServer.stop();
|
|
|
|
|
}
|
2019-10-31 20:43:47 -05:00
|
|
|
@Test
|
|
|
|
|
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
|
|
|
|
}
|
|
|
|
|
}
|