Skip to content

Commit 6d719a4

Browse files
committed
Add test to verify RedisCache.clear().
See #2028.
1 parent 4360c3a commit 6d719a4

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Diff for: src/test/java/org/springframework/data/redis/cache/RedisCacheTests.java

+18
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,30 @@ void evictShouldRemoveKey() {
224224

225225
doWithConnection(connection -> {
226226
connection.set(binaryCacheKey, binaryNullValue);
227+
connection.set("other".getBytes(), "value".getBytes());
227228
});
228229

229230
cache.evict(key);
230231

231232
doWithConnection(connection -> {
232233
assertThat(connection.exists(binaryCacheKey)).isFalse();
234+
assertThat(connection.exists("other".getBytes())).isTrue();
235+
});
236+
}
237+
238+
@ParameterizedRedisTest // GH-2028
239+
void clearShouldClearCache() {
240+
241+
doWithConnection(connection -> {
242+
connection.set(binaryCacheKey, binaryNullValue);
243+
connection.set("other".getBytes(), "value".getBytes());
244+
});
245+
246+
cache.clear();
247+
248+
doWithConnection(connection -> {
249+
assertThat(connection.exists(binaryCacheKey)).isFalse();
250+
assertThat(connection.exists("other".getBytes())).isTrue();
233251
});
234252
}
235253

0 commit comments

Comments
 (0)