DATAREDIS-367 - Polishing.

Add author tag and Override annotation. Update test to use try-with-resources.

Original pull request: #506.
This commit is contained in:
Mark Paluch
2020-01-10 11:29:40 +01:00
parent 163e9d4fac
commit f823062ef0
2 changed files with 6 additions and 1 deletions

View File

@@ -27,6 +27,7 @@ import org.springframework.dao.DataAccessException;
* @author Costin Leau
* @author Christoph Strobl
* @author Mark Paluch
* @author James Howe
*/
public interface RedisConnection extends RedisCommands, AutoCloseable {
@@ -145,6 +146,7 @@ public interface RedisConnection extends RedisCommands, AutoCloseable {
*
* @throws DataAccessException
*/
@Override
void close() throws DataAccessException;
/**

View File

@@ -52,6 +52,7 @@ import org.springframework.data.redis.ConnectionFactoryTracker;
import org.springframework.data.redis.connection.RedisClusterConfiguration;
import org.springframework.data.redis.connection.RedisClusterConnection;
import org.springframework.data.redis.connection.RedisConfiguration;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.RedisPassword;
import org.springframework.data.redis.connection.RedisSentinelConfiguration;
import org.springframework.data.redis.connection.RedisSocketConfiguration;
@@ -800,7 +801,9 @@ public class LettuceConnectionFactoryUnitTests {
connectionFactory.setValidateConnection(true);
connectionFactory.afterPropertiesSet();
connectionFactory.getConnection().close();
try (RedisConnection connection = connectionFactory.getConnection()) {
connection.ping();
}
verify(syncMock).ping();
}