1- package io .github .dunwu .javadb ;
1+ package io .github .dunwu .javadb . redis . jedis ;
22
3+ import lombok .extern .slf4j .Slf4j ;
34import org .junit .jupiter .api .AfterAll ;
45import org .junit .jupiter .api .Assertions ;
56import org .junit .jupiter .api .BeforeAll ;
67import org .junit .jupiter .api .Test ;
7- import org .slf4j .Logger ;
8- import org .slf4j .LoggerFactory ;
98import redis .clients .jedis .Jedis ;
109import redis .clients .jedis .exceptions .JedisConnectionException ;
1110
1514
1615/**
1716 * Jedis 测试例
17+ *
1818 * @author Zhang Peng
1919 * @see https://github.com/xetorthio/jedis
2020 */
21+ @ Slf4j
2122public class JedisDemoTest {
2223
2324 private static final String REDIS_HOST = "localhost" ;
@@ -26,8 +27,6 @@ public class JedisDemoTest {
2627
2728 private static Jedis jedis = null ;
2829
29- private static Logger logger = LoggerFactory .getLogger (JedisDemoTest .class );
30-
3130 @ BeforeAll
3231 public static void beforeClass () {
3332 // Jedis 有多种构造方法,这里选用最简单的一种情况
@@ -36,7 +35,7 @@ public static void beforeClass() {
3635 // 触发 ping 命令
3736 try {
3837 jedis .ping ();
39- logger .debug ("jedis 连接成功。" );
38+ log .debug ("jedis 连接成功。" );
4039 } catch (JedisConnectionException e ) {
4140 e .printStackTrace ();
4241 }
@@ -46,7 +45,7 @@ public static void beforeClass() {
4645 public static void afterClass () {
4746 if (null != jedis ) {
4847 jedis .close ();
49- logger .debug ("jedis 关闭连接。" );
48+ log .debug ("jedis 关闭连接。" );
5049 }
5150 }
5251
0 commit comments