package com.liquidnet.service.example.test;

import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.service.example.dto.base.LightNetSession;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
 * @author AnJiabin <jiabin.an@lightnet.io>
 * @version V1.0
 * @Description: TODO
 * @class: RedisUtilTest
 * @Package com.liquidnet.stellar
 * @Copyright: LightNet @ Copyright (c) 2020
 * @date 2020/8/26 13:48
 */
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
public class RedisUtilTest {
    @Autowired
    private RedisUtil redisUtil;

    @Test
    public void testRedisUtil(){
        System.out.println("test");
        LightNetSession lightNetSession = new LightNetSession();
        lightNetSession.setLogin(true);
        lightNetSession.setToken("ABCD123456");
        redisUtil.set("lightnetSessionId",lightNetSession);

        LightNetSession lightNetSession1 = (LightNetSession)redisUtil.get("lightnetSessionId");
        System.out.println("lightNetSession1===="+lightNetSession1.isLogin());
        System.out.println("lightNetSession1===="+lightNetSession1.getToken());
    }
}
