Add test to verify RedisCache.clear().

See #2028.
This commit is contained in:
Mark Paluch
2021-04-13 11:22:21 +02:00
parent 4360c3a8b8
commit 6d719a4292

View File

@@ -224,12 +224,30 @@ public class RedisCacheTests {
doWithConnection(connection -> {
connection.set(binaryCacheKey, binaryNullValue);
connection.set("other".getBytes(), "value".getBytes());
});
cache.evict(key);
doWithConnection(connection -> {
assertThat(connection.exists(binaryCacheKey)).isFalse();
assertThat(connection.exists("other".getBytes())).isTrue();
});
}
@ParameterizedRedisTest // GH-2028
void clearShouldClearCache() {
doWithConnection(connection -> {
connection.set(binaryCacheKey, binaryNullValue);
connection.set("other".getBytes(), "value".getBytes());
});
cache.clear();
doWithConnection(connection -> {
assertThat(connection.exists(binaryCacheKey)).isFalse();
assertThat(connection.exists("other".getBytes())).isTrue();
});
}