我正在尝试测试这个方法。我试着用mockito spy来获取数据,但没有按计划进行。
List<Optional<Facility>> cacheFacilities = new ArrayList<>();
RedisConnection redisConnection = null;
try {
LOGGER.info("Making redis connection......");
redisConnection = redisTemplate.getConnectionFactory().getConnection();
LOGGER.info("Successfully made redis connection......");
ScanOptions options = ScanOptions.scanOptions().build();
Cursor c = redisConnection.scan(options);
while (c.hasNext()) {
String facilityKey = new String((byte[]) c.next());
facilityKey = facilityKey.substring(facilityKey.indexOf("Facility:") + 9);
cacheFacilities.add(facilityRepository.findById(facilityKey));
}
}
finally {
redisConnection.close();
LOGGER.info("Redis connection closed!!");
}```
I am using RedisTemplate for making the connection. Could someone please help me with this. I want to test these lines of code.
暂无答案!
目前还没有任何答案,快来回答吧!