We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 994553c + eb65992 commit f1e0d13Copy full SHA for f1e0d13
1 file changed
src/test/java/com/knu/ddip/DBTest/RedisForTestConnectionTest.java
@@ -41,17 +41,13 @@ public void testRedisConnection() {
41
@Test
42
public void testRedisConnectionInfo() {
43
// When
44
- RedisConnection connection = redisTemplate.getConnectionFactory().getConnection();
45
-
46
- try {
+ try (RedisConnection connection = redisTemplate.getConnectionFactory().getConnection()) {
47
// Then
48
assertThat(connection).isNotNull();
49
assertThat(connection.ping()).isNotNull();
50
51
System.out.println("Redis connection successful");
52
- System.out.println("Redis ping response: " + new String(connection.ping()));
53
- } finally {
54
- connection.close();
+ System.out.println("Redis ping response: " + connection.ping());
55
}
56
57
0 commit comments