DevicePowerMapperTest.java 1.22 KB
package cn.com.glsx.stdinterface.modules.mapper;

import cn.com.glsx.Application;
import cn.com.glsx.stdinterface.modules.entity.DevicePower;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.Date;
import java.util.List;

import static org.junit.jupiter.api.Assertions.*;

/**
 * @author xiangyanlin
 * @date 2022/4/15
 */
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
class DevicePowerMapperTest {

    @Autowired
    private DevicePowerMapper devicePowerMapper;

    @Test
    public void testInsertOrUpdateBatch(){
        DevicePower devicePower = new DevicePower();
        devicePower.setAlarmTime(new Date());
        devicePower.setSn("1610507001");
        devicePower.setSoc(99);
        devicePower.setUpdatedDate(new Date());
        List<DevicePower> list =Lists.newArrayList(devicePower);
        devicePowerMapper.insertOrUpdateBatch(list);
    }

}