package com.sptg.permissions.biz;

import com.baomidou.mybatisplus.toolkit.IdWorker;
import com.sptg.common.core.util.CommonUtil;
import com.sptg.common.core.util.JsonUtils;
import com.sptg.permissions.api.entity.RoleMenu;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;

import java.text.SimpleDateFormat;
import java.util.*;

/**
 * title: JunityTest
 * package: com.sptg.permissions.biz
 * description: 测试用例
 *
 *                  
 *                
 */
@Slf4j
public class JunityTest {

    @Test
    public void testArrayList(){
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
        Calendar calendar = Calendar.getInstance();
        //                              1    2    3    4    5    6   7
        String[] array = new String[]{ "日","一","二","三","四","五","六" };
        int i = calendar.get(Calendar.WEEK_OF_MONTH);
        System.out.println(i);
        calendar.add(Calendar.DATE, i == 1 ? i : 9 - i);
        System.out.println(df.format(calendar.getTime()));

        System.out.println(calendar.get(Calendar.WEEK_OF_MONTH));
    }

    @Test
    public void testEnittyList(){
        RoleMenu roleMenu = new RoleMenu();
        roleMenu.setRoleId(1L);
        int len = 5;
        List<RoleMenu> list = new ArrayList<>(len);
        for (long i = 0; i < len; i++){
            roleMenu.setMenuId(i);
            list.add(roleMenu);
        }
        log.warn(JsonUtils.objectToJson(list));
    }

    @Test
    public void test(){
//        GregorianCalendar calendar = new GregorianCalendar();
//        calendar.add(GregorianCalendar.DATE, 1);
//        calendar.set(Calendar.HOUR_OF_DAY, 3);
//        calendar.set(Calendar.MINUTE, 0);
//        calendar.set(Calendar.SECOND, 0);
//        calendar.set(Calendar.MILLISECOND, 0);
//        Date date = calendar.getTime();
//        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//        log.warn(format.format(date));

    }
}
