Add assertions asserting that mock Apache Geode Objects are being used.
This commit is contained in:
@@ -17,10 +17,17 @@ package org.springframework.geode.boot.autoconfigure.caching;
|
|||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
import org.apache.geode.cache.Region;
|
||||||
|
import org.apache.geode.cache.client.ClientCache;
|
||||||
|
import org.apache.geode.internal.cache.AbstractRegion;
|
||||||
|
import org.apache.geode.internal.cache.GemFireCacheImpl;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.SpringBootConfiguration;
|
import org.springframework.boot.SpringBootConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||||
@@ -39,6 +46,8 @@ import example.test.service.TestCacheableService;
|
|||||||
*
|
*
|
||||||
* @author John Blum
|
* @author John Blum
|
||||||
* @see org.junit.Test
|
* @see org.junit.Test
|
||||||
|
* @see org.apache.geode.cache.Region
|
||||||
|
* @see org.apache.geode.cache.client.ClientCache
|
||||||
* @see org.springframework.boot.autoconfigure.SpringBootApplication
|
* @see org.springframework.boot.autoconfigure.SpringBootApplication
|
||||||
* @see org.springframework.boot.test.context.SpringBootTest
|
* @see org.springframework.boot.test.context.SpringBootTest
|
||||||
* @see org.springframework.data.gemfire.config.annotation.EnableCachingDefinedRegions
|
* @see org.springframework.data.gemfire.config.annotation.EnableCachingDefinedRegions
|
||||||
@@ -53,11 +62,23 @@ import example.test.service.TestCacheableService;
|
|||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class AutoConfiguredCachingUnitTests extends IntegrationTestsSupport {
|
public class AutoConfiguredCachingUnitTests extends IntegrationTestsSupport {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ClientCache clientCache;
|
||||||
|
|
||||||
|
@Resource(name = "RandomNumbers")
|
||||||
|
private Region<String, Number> randomNumbers;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TestCacheableService cacheableService;
|
private TestCacheableService cacheableService;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setup() {
|
||||||
|
|
||||||
|
assertThat(this.clientCache).isNotNull();
|
||||||
|
assertThat(this.clientCache).isNotInstanceOf(GemFireCacheImpl.class);
|
||||||
|
assertThat(this.randomNumbers).isNotNull();
|
||||||
|
// TODO: Why is AbstractRegion internal!?!?! #argh
|
||||||
|
assertThat(this.randomNumbers).isNotInstanceOf(AbstractRegion.class);
|
||||||
assertThat(this.cacheableService).isNotNull();
|
assertThat(this.cacheableService).isNotNull();
|
||||||
assertThat(this.cacheableService.isCacheMiss()).isFalse();
|
assertThat(this.cacheableService.isCacheMiss()).isFalse();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user