package com.yxcheng.token.utils;

import lombok.extern.slf4j.Slf4j;
import org.junit.Test;

import java.util.Date;

import static org.junit.Assert.*;

/**
 * @author caosongqing
 * @date 2022/7/27
 * @description
 */
@Slf4j
public class DateUtilsTest {

    @Test
    public void testGetPastDate() {
        Date now = new Date();
        Date date = DateUtils.getPastDate(3);
        log.info("current date:{}", date);
        assertEquals(4320, DateUtils.getMinutesDiff(date, now));
    }

    @Test
    public void testGetDateMoveHour() {
        Date now = new Date();
        Date date = DateUtils.getDateMoveHour(3);
        log.info("current date:{}", date);
        assertEquals(180, DateUtils.getMinutesDiff(date, now));
    }
}