CaptionTest.java 1.46 KB
package com.viontech.storage.mapper;

import cn.hutool.json.JSONConfig;
import cn.hutool.json.JSONUtil;
import com.viontech.storage.model.Caption;
import com.viontech.storage.model.CaptionSet;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;
import java.util.List;

/**
 * .
 *
 * @author 谢明辉
 * @date 2021/11/8
 */


@RunWith(SpringRunner.class)
@SpringBootTest
@ActiveProfiles("test")
public class CaptionTest {

    @Resource
    private CaptionMapper captionMapper;

    @Test
    public void insetCaptionSet() {
        Caption caption = new Caption()
                .setCaptionSetId(1L)
                .setEnabled(true)
                .setBgColor(1)
                .setBgTransparency(1)
                .setDateFormat("yyyy-MM-dd HH:mm:ss:xxx")
                .setFont(1)
                .setFontSize(10)
                .setPicType(1)
                .setFgColor(1)
                .setContext("testContext");
        int insert = captionMapper.insert(caption);
        System.out.println(insert);
    }

    @Test
    public void captionTest() {
        List<Caption> captions = captionMapper.selectList(null);
        captions.forEach(x -> System.out.println(JSONUtil.toJsonStr(x, JSONConfig.create().setDateFormat("yyyy-MM-dd HH:mm:ss"))));
    }

}