2020-02-12 19:55:28 +01:00
|
|
|
package com.baeldung;
|
2019-10-31 20:43:47 -05:00
|
|
|
|
2020-10-17 12:36:50 +03:00
|
|
|
import org.junit.AfterClass;
|
|
|
|
import org.junit.BeforeClass;
|
2019-10-31 20:43:47 -05:00
|
|
|
import org.junit.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)
|
2019-10-31 20:43:47 -05:00
|
|
|
public class SpringContextTest {
|
2020-10-17 12:36:50 +03:00
|
|
|
|
|
|
|
private static redis.embedded.RedisServer redisServer;
|
|
|
|
|
|
|
|
@BeforeClass
|
|
|
|
public static void startRedisServer() {
|
|
|
|
redisServer = new RedisServerBuilder().port(6379).setting("maxmemory 256M").build();
|
|
|
|
redisServer.start();
|
|
|
|
}
|
2019-10-31 20:43:47 -05:00
|
|
|
|
2020-10-17 12:36:50 +03:00
|
|
|
@AfterClass
|
|
|
|
public static void stopRedisServer() {
|
|
|
|
redisServer.stop();
|
|
|
|
}
|
2019-10-31 20:43:47 -05:00
|
|
|
@Test
|
|
|
|
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
|
|
|
}
|
|
|
|
}
|