Skip to content

Commit 7ed4273

Browse files
committed
Fix Redis Cache tests after key prefix changes
Update Redis Cache tests after changes in DATAREDIS-715.
1 parent 99466e7 commit 7ed4273

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,8 @@ public void redisCacheExplicit() {
283283
.withPropertyValues("spring.cache.type=redis",
284284
"spring.cache.redis.time-to-live=15000",
285285
"spring.cache.redis.cacheNullValues=false",
286-
"spring.cache.redis.keyPrefix=foo",
287-
"spring.cache.redis.useKeyPrefix=false")
286+
"spring.cache.redis.keyPrefix=prefix",
287+
"spring.cache.redis.useKeyPrefix=true")
288288
.run((context) -> {
289289
RedisCacheManager cacheManager = getCacheManager(context,
290290
RedisCacheManager.class);
@@ -295,8 +295,8 @@ public void redisCacheExplicit() {
295295
.isEqualTo(java.time.Duration.ofSeconds(15));
296296
assertThat(redisCacheConfiguration.getAllowCacheNullValues())
297297
.isFalse();
298-
assertThat(redisCacheConfiguration.getKeyPrefix()).contains("foo");
299-
assertThat(redisCacheConfiguration.usePrefix()).isFalse();
298+
assertThat(redisCacheConfiguration.getKeyPrefixFor("keyName")).isEqualTo("prefix");
299+
assertThat(redisCacheConfiguration.usePrefix()).isTrue();
300300
});
301301
}
302302

@@ -342,7 +342,7 @@ public void redisCacheExplicitWithCaches() {
342342
.isEqualTo(java.time.Duration.ofMinutes(0));
343343
assertThat(redisCacheConfiguration.getAllowCacheNullValues())
344344
.isTrue();
345-
assertThat(redisCacheConfiguration.getKeyPrefix()).isEmpty();
345+
assertThat(redisCacheConfiguration.getKeyPrefixFor("test")).isEqualTo("test::");
346346
assertThat(redisCacheConfiguration.usePrefix()).isTrue();
347347
});
348348
}

0 commit comments

Comments
 (0)