Add assertions asserting that mock Apache Geode Objects are being used.

This commit is contained in:
John Blum
2019-10-31 12:27:23 -07:00
parent 4a1028105f
commit caa8a2cb42

View File

@@ -17,10 +17,17 @@ package org.springframework.geode.boot.autoconfigure.caching;
import static org.assertj.core.api.Assertions.assertThat;
import javax.annotation.Resource;
import org.junit.Before;
import org.junit.Test;
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.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -39,6 +46,8 @@ import example.test.service.TestCacheableService;
*
* @author John Blum
* @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.test.context.SpringBootTest
* @see org.springframework.data.gemfire.config.annotation.EnableCachingDefinedRegions
@@ -53,11 +62,23 @@ import example.test.service.TestCacheableService;
@SuppressWarnings("unused")
public class AutoConfiguredCachingUnitTests extends IntegrationTestsSupport {
@Autowired
private ClientCache clientCache;
@Resource(name = "RandomNumbers")
private Region<String, Number> randomNumbers;
@Autowired
private TestCacheableService cacheableService;
@Before
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.isCacheMiss()).isFalse();
}