File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
persistence-modules/spring-data-redis/src/test/java/org/baeldung Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change 1
1
package org .baeldung ;
2
2
3
+ import com .baeldung .spring .data .redis .config .RedisConfig ;
4
+ import org .junit .AfterClass ;
5
+ import org .junit .BeforeClass ;
3
6
import org .junit .Test ;
4
7
import org .junit .runner .RunWith ;
8
+ import org .springframework .test .annotation .DirtiesContext ;
5
9
import org .springframework .test .context .ContextConfiguration ;
6
10
import org .springframework .test .context .junit4 .SpringJUnit4ClassRunner ;
11
+ import redis .embedded .RedisServerBuilder ;
7
12
8
- import com . baeldung . spring . data . redis . config . RedisConfig ;
13
+ import static org . springframework . test . annotation . DirtiesContext . ClassMode . BEFORE_CLASS ;
9
14
10
15
@ RunWith (SpringJUnit4ClassRunner .class )
16
+ @ DirtiesContext (classMode = BEFORE_CLASS )
11
17
@ ContextConfiguration (classes = RedisConfig .class )
12
18
public class SpringContextIntegrationTest {
13
19
20
+ private static redis .embedded .RedisServer redisServer ;
21
+
22
+ @ BeforeClass
23
+ public static void startRedisServer () {
24
+ redisServer = new RedisServerBuilder ().port (6379 ).setting ("maxmemory 256M" ).build ();
25
+ redisServer .start ();
26
+ }
27
+
28
+ @ AfterClass
29
+ public static void stopRedisServer () {
30
+ redisServer .stop ();
31
+ }
32
+
14
33
@ Test
15
34
public void whenSpringContextIsBootstrapped_thenNoExceptions () {
16
35
}
You can’t perform that action at this time.
0 commit comments