@ -1,5 +1,5 @@
/ *
* Copyright 2012 - 201 6 the original author or authors .
* Copyright 2012 - 201 7 the original author or authors .
*
* Licensed under the Apache License , Version 2.0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
@ -24,13 +24,10 @@ import org.junit.Test;
import org.springframework.beans.DirectFieldAccessor ;
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration ;
import org.springframework.boot.redis.RedisTestServer ;
import org.springframework.boot.test.rule.OutputCapture ;
import org.springframework.session.data.redis.RedisFlushMode ;
import org.springframework.session.data.redis.RedisOperationsSessionRepository ;
import static org.assertj.core.api.Assertions.assertThat ;
import static org.hamcrest.CoreMatchers.not ;
import static org.hamcrest.Matchers.containsString ;
/ * *
* Redis specific tests for { @link SessionAutoConfiguration } .
@ -40,27 +37,14 @@ import static org.hamcrest.Matchers.containsString;
public class SessionAutoConfigurationRedisTests
extends AbstractSessionAutoConfigurationTests {
@Rule
public OutputCapture output = new OutputCapture ( ) ;
@Rule
public final RedisTestServer redis = new RedisTestServer ( ) ;
@Test
public void redisSessionStoreIsTheDefault ( ) {
load ( Collections . < Class < ? > > singletonList ( RedisAutoConfiguration . class ) ) ;
validateSpringSessionUsesRedis ( ) ;
this . output . expect ( containsString (
"Spring Session store type is mandatory: set 'spring.session.store-type=redis' in your configuration" ) ) ;
}
@Test
public void redisSessionStore ( ) {
load ( Collections . < Class < ? > > singletonList ( RedisAutoConfiguration . class ) ,
"spring.session.store-type=redis" ) ;
validateSpringSessionUsesRedis ( ) ;
this . output . expect ( not ( containsString (
"Spring Session store type is mandatory: set 'spring.session.store-type=redis' in your configuration" ) ) ) ;
}
private void validateSpringSessionUsesRedis ( ) {