CaptionSetTest.java 1.28 KB
package com.viontech.storage.mapper;

import cn.hutool.json.JSON;
import cn.hutool.json.JSONUtil;
import com.viontech.storage.mapper.CaptionSetMapper;
import com.viontech.storage.model.CaptionSet;
import com.viontech.storage.service.CaptionService;
import com.viontech.storage.service.CaptionSetService;
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 CaptionSetTest {

    @Resource
    private CaptionSetService captionSetService;

    @Test
    public void insetCaptionSet() {
        CaptionSet captionSet = new CaptionSet();
        captionSet.setName("name");
        captionSet.setIntro("intro");

        boolean save = captionSetService.save(captionSet);
        System.out.println(JSONUtil.toJsonStr(captionSet));
    }

    @Test
    public void selectCaptionSet() {
        List<CaptionSet> captionSets = captionSetService.list();
        captionSets.forEach(x -> System.out.println(JSONUtil.toJsonStr(x)));
    }

}