Switch to a MOCK WebEnvironment.

Add additional assertions.
This commit is contained in:
John Blum
2019-11-15 18:39:15 -08:00
parent 2c7ee8fda8
commit 1a091a5209
2 changed files with 11 additions and 8 deletions

View File

@@ -18,12 +18,12 @@ package org.springframework.geode.boot.autoconfigure.session;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import org.apache.geode.cache.GemFireCache;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.apache.geode.cache.GemFireCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.context.SpringBootTest;
@@ -62,7 +62,7 @@ import org.springframework.test.context.junit4.SpringRunner;
* @since 1.0.0
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.MOCK)
@SuppressWarnings("unused")
public class ManuallyConfiguredSessionCachingIntegrationTests extends IntegrationTestsSupport {
@@ -93,6 +93,7 @@ public class ManuallyConfiguredSessionCachingIntegrationTests extends Integratio
assertThat(sessionRepository).isNotNull();
assertThat(sessionRepository).isNotInstanceOf(GemFireOperationsSessionRepository.class);
assertThat(sessionRepository.getClass().getName().toLowerCase()).doesNotContain("redis");
}
@SpringBootApplication

View File

@@ -17,12 +17,12 @@ package org.springframework.geode.boot.autoconfigure.session;
import static org.assertj.core.api.Assertions.assertThat;
import org.apache.geode.cache.GemFireCache;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.apache.geode.cache.GemFireCache;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -53,7 +53,7 @@ import org.springframework.test.context.junit4.SpringRunner;
* @since 1.0.0
*/
@RunWith(SpringRunner.class)
@SpringBootTest(properties = "spring.session.store-type=none")
@SpringBootTest(properties = "spring.session.store-type=none", webEnvironment = SpringBootTest.WebEnvironment.MOCK)
@SuppressWarnings("unused")
public class ManuallyConfiguredWithPropertiesSessionCachingIntegrationTests extends IntegrationTestsSupport {
@@ -68,10 +68,12 @@ public class ManuallyConfiguredWithPropertiesSessionCachingIntegrationTests exte
@Test(expected = NoSuchBeanDefinitionException.class)
public void gemfireSessionRegionAndSessionRepositoryAreNotPresent() {
String sessionsRegionName = GemFireHttpSessionConfiguration.DEFAULT_SESSION_REGION_NAME;
assertThat(this.applicationContext.containsBean("gemfireCache")).isTrue();
assertThat(this.applicationContext.containsBean("sessionRepository")).isFalse();
assertThat(this.applicationContext.containsBean(GemFireHttpSessionConfiguration.DEFAULT_SESSION_REGION_NAME))
.isFalse();
assertThat(this.applicationContext.containsBean(sessionsRegionName)).isFalse();
assertThat(this.applicationContext.getBeansOfType(SessionRepository.class)).isEmpty();
GemFireCache gemfireCache = this.applicationContext.getBean(GemFireCache.class);