use of com.amazonaws.services.elasticache.model.CacheNode in project spring-cloud-aws by awspring.
the class ElastiCacheFactoryBeanTest method getObject_clusterWithRedisEngineConfigured_reportsError.
@Test
void getObject_clusterWithRedisEngineConfigured_reportsError() throws Exception {
// Arrange
AmazonElastiCache amazonElastiCache = mock(AmazonElastiCacheClient.class);
DescribeCacheClustersRequest memcached = new DescribeCacheClustersRequest().withCacheClusterId("memcached");
memcached.setShowCacheNodeInfo(true);
when(amazonElastiCache.describeCacheClusters(memcached)).thenReturn(new DescribeCacheClustersResult().withCacheClusters(new CacheCluster().withEngine("redis").withCacheNodes(new CacheNode().withEndpoint(new Endpoint().withAddress("localhost").withPort(45678)))));
ElastiCacheFactoryBean elastiCacheFactoryBean = new ElastiCacheFactoryBean(amazonElastiCache, "memcached", Collections.singletonList(new TestCacheFactory("testCache", "localhost", 45678)));
// Assert
assertThatThrownBy(elastiCacheFactoryBean::afterPropertiesSet).isInstanceOf(IllegalArgumentException.class).hasMessageContaining("engine");
}
Aggregations