Newer
Older
newfiber-termite / newfiber-termites / newfiber-termites-package / src / test / java / ServiceTest.java
@xiongkai xiongkai on 9 Oct 2 KB 统计优化
  1. import com.newfiber.common.core.utils.file.FileUtils;
  2. import com.newfiber.termite.NewfiberTermiteApplication;
  3. import com.newfiber.termite.domain.dto.PhotoIdentifyDto;
  4. import com.newfiber.termite.domain.dto.TermiteDataUpRequest;
  5. import com.newfiber.termite.domain.response.DataUpResponse;
  6. import com.newfiber.termite.enums.EExistsAnt;
  7. import com.newfiber.termite.mapper.TermiteMapper;
  8. import com.newfiber.termite.service.ISmsRecordService;
  9. import com.newfiber.termite.service.impl.TermiteServiceImpl;
  10. import java.io.File;
  11. import javax.annotation.Resource;
  12. import org.junit.Test;
  13. import org.junit.runner.RunWith;
  14. import org.springframework.boot.test.context.SpringBootTest;
  15. import org.springframework.test.context.junit4.SpringRunner;
  16. import org.springframework.web.multipart.MultipartFile;
  17.  
  18. @SpringBootTest(classes = NewfiberTermiteApplication.class)
  19. @RunWith(SpringRunner.class)
  20. public class ServiceTest {
  21.  
  22. @Resource
  23. private TermiteMapper termiteMapper;
  24.  
  25. @Resource
  26. private TermiteServiceImpl termiteService;
  27.  
  28. @Resource
  29. private ISmsRecordService smsRecordService;
  30.  
  31. @Test
  32. public void termiteDataupTest() throws Exception{
  33. TermiteDataUpRequest termiteDataUpRequest = new TermiteDataUpRequest();
  34. termiteDataUpRequest.setSn("ANT231031003");
  35. MultipartFile multipartFile = FileUtils.getMultipartFile(new File("C:\\Users\\Administrator\\Downloads\\复位.png"));
  36. DataUpResponse dataUpResponse = termiteService.termiteDataup(termiteDataUpRequest, multipartFile);
  37. System.out.println(dataUpResponse.toString());
  38. }
  39.  
  40. @Test
  41. public void photoIdentifyTest() throws Exception{
  42. PhotoIdentifyDto photoIdentifyDto = new PhotoIdentifyDto();
  43. photoIdentifyDto.setId("1795644012890468354");
  44. photoIdentifyDto.setYesnoant(EExistsAnt.True.getCode());
  45. MultipartFile multipartFile = FileUtils.getMultipartFile(new File("C:\\Users\\Administrator\\Downloads\\复位.png"));
  46. String url = termiteService.photoIdentify(photoIdentifyDto, multipartFile);
  47. System.out.println(url);
  48. }
  49.  
  50. @Test
  51. public void smsTest(){
  52. smsRecordService.send("wulinshuiku", "10-1");
  53. }
  54. }