yangys
2025-08-07 bc4056543fdbef38ac8bf1648df934d5bc8e5bde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package org.springblade.mdm.program.entity;
 
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springblade.core.tool.utils.DateUtil;
 
import java.time.LocalDate;
 
public class NcNodeTest {
    @Test
    public void testWithinValidPired() {
        NcNode node = new NcNode();
        LocalDate now = LocalDate.now();
        //过期时间设置未第二天
        LocalDate date = now.plusDays(1);
        node.setExpireDate(DateUtil.toDate(date));
        //在有效期内
        Assertions.assertTrue(node.withinValidityPeriod());
 
        date = now.minusDays(1);
        node.setExpireDate(DateUtil.toDate(date));
        Assertions.assertFalse(node.withinValidityPeriod());
    }
}