Newer
Older
newfiber-termite / newfiber-termites / newfiber-termites-package / src / test / java / ServiceTest.java
@xiongkai xiongkai on 9 Oct 2 KB 统计优化
import com.newfiber.common.core.utils.file.FileUtils;
import com.newfiber.termite.NewfiberTermiteApplication;
import com.newfiber.termite.domain.dto.PhotoIdentifyDto;
import com.newfiber.termite.domain.dto.TermiteDataUpRequest;
import com.newfiber.termite.domain.response.DataUpResponse;
import com.newfiber.termite.enums.EExistsAnt;
import com.newfiber.termite.mapper.TermiteMapper;
import com.newfiber.termite.service.ISmsRecordService;
import com.newfiber.termite.service.impl.TermiteServiceImpl;
import java.io.File;
import javax.annotation.Resource;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.multipart.MultipartFile;

@SpringBootTest(classes = NewfiberTermiteApplication.class)
@RunWith(SpringRunner.class)
public class ServiceTest {

    @Resource
    private TermiteMapper termiteMapper;

    @Resource
    private TermiteServiceImpl termiteService;

    @Resource
    private ISmsRecordService smsRecordService;

    @Test
    public void termiteDataupTest() throws Exception{
        TermiteDataUpRequest termiteDataUpRequest = new TermiteDataUpRequest();
        termiteDataUpRequest.setSn("ANT231031003");
        MultipartFile multipartFile = FileUtils.getMultipartFile(new File("C:\\Users\\Administrator\\Downloads\\复位.png"));
        DataUpResponse dataUpResponse = termiteService.termiteDataup(termiteDataUpRequest, multipartFile);
        System.out.println(dataUpResponse.toString());
    }

    @Test
    public void photoIdentifyTest() throws Exception{
        PhotoIdentifyDto photoIdentifyDto = new PhotoIdentifyDto();
        photoIdentifyDto.setId("1795644012890468354");
        photoIdentifyDto.setYesnoant(EExistsAnt.True.getCode());
        MultipartFile multipartFile = FileUtils.getMultipartFile(new File("C:\\Users\\Administrator\\Downloads\\复位.png"));
        String url = termiteService.photoIdentify(photoIdentifyDto, multipartFile);
        System.out.println(url);
    }

    @Test
    public void smsTest(){
        smsRecordService.send("wulinshuiku", "10-1");
    }
}