Commit b3be24fc3fca2196d6f04c985c83459e39be706c

Authored by 徐泉
1 parent c6a8099f
Exists in master

测试类提交

cloud/dahua/src/test/java/com/example/dahua/Tester.java 0 → 100644
@@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
  1 +package com.example.dahua;
  2 +
  3 +
  4 +import org.junit.runner.RunWith;
  5 +import org.springframework.boot.test.context.SpringBootTest;
  6 +import org.springframework.test.context.junit4.SpringRunner;
  7 +
  8 +/**
  9 + * 单元测试继承该类即可
  10 + */
  11 +@RunWith(SpringRunner.class)
  12 +@SpringBootTest
  13 +public abstract class Tester {}
  14 +
  15 +
  16 +
cloud/dahua/src/test/java/com/example/dahua/mapper/SearchMapperTest.java 0 → 100644
@@ -0,0 +1,64 @@ @@ -0,0 +1,64 @@
  1 +package com.example.dahua.mapper;
  2 +
  3 +import com.alibaba.fastjson.JSON;
  4 +import com.example.dahua.Tester;
  5 +import com.example.dahua.bean.CheckIn;
  6 +import com.example.dahua.bean.ShortMsg;
  7 +import com.example.dahua.dao.UserDao;
  8 +import com.example.dahua.utils.DateUtils;
  9 +import com.example.dahua.xiananDao.SearchMapper;
  10 +import org.junit.Test;
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +
  13 +import java.util.Date;
  14 +
  15 +/**
  16 + * TODO
  17 + *
  18 + * @author xuquan
  19 + * @date 2020/11/11 12:13
  20 + */
  21 +
  22 +public class SearchMapperTest extends Tester {
  23 +
  24 + @Autowired
  25 + private SearchMapper searchMapper;
  26 +
  27 + @Autowired
  28 + private UserDao userDao;
  29 +
  30 + @Test
  31 + public void test(){
  32 + //有效刷卡调考勤存储过程
  33 + CheckIn checkIn = new CheckIn();
  34 + checkIn.setDeviceId("1212");
  35 + checkIn.setCardNo("24234");
  36 + checkIn.setFunNo(8);
  37 + checkIn.setFlag(1);
  38 + checkIn.setCheckTime("2020-11-11 12:19:12");
  39 + searchMapper.checkIn(checkIn);
  40 + System.out.println(JSON.toJSON(checkIn));
  41 + }
  42 +
  43 + @Test
  44 + public void test2(){
  45 + userDao.checkLeave("234232");
  46 + System.out.println(JSON.toJSON(userDao.checkLeave("234232")));
  47 + userDao.selectByParentMobile("234232");
  48 + System.out.println(JSON.toJSON(userDao.checkLeave("234232")));
  49 + userDao.checkLeave("234232");
  50 + System.out.println(JSON.toJSON(userDao.checkLeave("234232")));
  51 + }
  52 +
  53 + @Test
  54 + public void test3(){
  55 + ShortMsg shortMsg = new ShortMsg();
  56 + String tableSuffix = DateUtils.date2String(new Date(), DateUtils.format);
  57 + shortMsg.setTableName("smsNew" + tableSuffix);
  58 + shortMsg.setSchoolId(23);
  59 + shortMsg.setMobile("124124242");
  60 + userDao.insertMessage();
  61 + System.out.println(JSON.toJSON(userDao.checkLeave("234232")));
  62 +
  63 + }
  64 +}