Springboot中自已测试
签到的测试,需要传入日期,签到7天可获得更多的积分,
构造7天前的签到记录,重写签到方法,进行构造数据
import cn.com.acxiom.coty.api.ws.bean.dto.PointDetailRequest;
import cn.com.acxiom.coty.api.ws.bean.dto.SignInHisResponse;
import cn.com.acxiom.coty.api.ws.common.ResponseBean;
import cn.com.acxiom.coty.api.ws.service.PEService;
import cn.com.acxiom.coty.api.ws.service.SignInService;
import cn.com.acxiom.point.engine.domain.response.PointQueryDetail;
import com.alibaba.fastjson.JSONArray;
import org.junit.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.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List; @RunWith(SpringRunner.class)
@SpringBootTest
public class TestPE { @Autowired
PEService peService; @Autowired
SignInService signInService; @Test
//@Async
public void SignIn() throws Exception {
peService.sendEvent(500647, "coty.api.ws", "TMALLSIGNIN");
} @Test
public void CheckPEDetails() throws Exception { long dtLong = new Date().getTime();
System.out.println(dtLong);
ResponseBean<List<PointQueryDetail>> responseBean = new ResponseBean<List<PointQueryDetail>>();
PointDetailRequest pointDetailRequest = new PointDetailRequest();
pointDetailRequest.setEndDate("2019-12-12");
pointDetailRequest.setPageIndex(0);
pointDetailRequest.setPageSize(50);
pointDetailRequest.setStartDate("2019-01-01");
String social="AcxiomChina";
String user="VP巴黎恋人";
String sysName="Jasmine Test";
String pePointDetailCode= "POINTDETAIL_QUERY"; List<PointQueryDetail> pointQueryDetails = peService.findPointDetailByUser(social, user, sysName, pePointDetailCode, pointDetailRequest);
JSONArray jsonArray = (JSONArray) JSONArray.toJSON(pointQueryDetails);
responseBean.setData(pointQueryDetails);
System.out.println(jsonArray.toJSONString()); ; } @Test
public void Sign(){
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); int N =1;
while(N<25){
Calendar ca = Calendar.getInstance();//得到一个Calendar的实例
ca.setTime(new Date()); //设置时间为当前时间
ca.add(Calendar.DATE, N);
long time= ca.getTime().getTime();
System.out.println(sd.format(time));
String social="AcxiomChina";
String userId="VP巴黎恋人"; SignInHisResponse signInHisResponse = signInService.tmallSignInWithTime(userId,social,time);
System.out.println("signInHisResponse是个啥"+signInHisResponse);
//JSONArray jsonArray = (JSONArray) JSONArray.toJSON(signInHisResponse);
//System.out.println(jsonArray.toJSONString());
N++;
} } }
Springboot中自已测试的更多相关文章
- Springboot的日志管理&Springboot整合Junit测试&Springboot中AOP的使用
==============Springboot的日志管理============= springboot无需引入日志的包,springboot默认已经依赖了slf4j.logback.log4j等日 ...
- springBoot中使用使用junit测试文件上传,以及文件下载接口编写
本篇文章将介绍如何使junit在springBoot中测试文件的上传,首先先阅读如何在springBoot中进行接口测试. 文件上传操作测试代码 import org.junit.Before; im ...
- 测试开发专题:如何在spring-boot中进行参数校验
上文我们讨论了spring-boot如何去获取前端传递过来的参数,那传递过来总不能直接使用,需要对这些参数进行校验,符合程序的要求才会进行下一步的处理,所以本篇文章我们主要讨论spring-boot中 ...
- springboot中swaggerUI的使用
demo地址:demo-swagger-springboot springboot中swaggerUI的使用 1.pom文件中添加swagger依赖 2.从github项目中下载swaggerUI 然 ...
- 由浅入深学习springboot中使用redis
很多时候,我们会在springboot中配置redis,但是就那么几个配置就配好了,没办法知道为什么,这里就详细的讲解一下 这里假设已经成功创建了一个springboot项目. redis连接工厂类 ...
- SpringBoot 中常用注解
本篇博文将介绍几种SpringBoot 中常用注解 其中,各注解的作用为: @PathVaribale 获取url中的数据 @RequestParam 获取请求参数的值 @GetMapping 组合注 ...
- SpringBoot(四)SpringBoot中lombok使用
lombok概述 lombok简介 Lombok想要解决了的是在我们实体Bean中大量的Getter/Setter方法,以及toString, hashCode等可能不会用到,但是某些时候仍然需要复写 ...
- SpringBoot 中常用注解@PathVaribale/@RequestParam/@GetMapping介绍
SpringBoot 中常用注解@PathVaribale/@RequestParam/@GetMapping介绍 本篇博文将介绍几种如何处理url中的参数的注解@PathVaribale/@Requ ...
- springboot中配置过滤器以及可能出现的问题
在springboot添加过滤器有两种方式: 1.通过创建FilterRegistrationBean的方式(建议使用此种方式,统一管理,且通过注解的方式若不是本地调试,如果在filter中需要增加c ...
随机推荐
- pipline脚本k8s版
def label = "jnlp-slave" podTemplate(label: label, cloud: 'kubernetes',containers: [ conta ...
- c-lodop回调函数简短问答及相关博文
回调函数相关博文:C-Lodop回调函数的触发.LODOP.FORMAT格式转换[回调和直接返回值].Lodop导出excel及提示成功[回调和直接返回值].c-lodop获取任务页数-回调里给全局变 ...
- [LeetCode] 92. Reverse Linked List II 反向链表II
Reverse a linked list from position m to n. Do it in-place and in one-pass. For example:Given 1-> ...
- 【视频开发】EasyIPCamera通过RTSP协议接入海康、大华等摄像机,摒弃私有SDK接入弊端
近期工作中需要开发一套视频监控系统,实现WEB端.手机APP端预览局域网内的道路监控摄像机,我负责一些后台服务的开发工作. 由于之前项目中的程序都是采用私有协议.各摄像机厂商的SDK进行视频监控系统开 ...
- QT_QML_常见问题
1. qml文件中,如果要添加信号连接,如果与控件x有丁点关联,则将Connections{}最好放到该控件的{}内部,不这样做曾经遇到接受不到信号的奇葩问题. 2. 使用TabView时,在每个Ta ...
- LeetCode 653. 两数之和 IV - 输入 BST(Two Sum IV - Input is a BST)
653. 两数之和 IV - 输入 BST 653. Two Sum IV - Input is a BST 题目描述 给定一个二叉搜索树和一个目标结果,如果 BST 中存在两个元素且它们的和等于给定 ...
- vue中指令绑定的v-if逻辑结构
<!-- if判断 --> <div id="app2"> <p v-if="seen"> <!-- 给p标签绑定指令 ...
- Java 理论和实践: 了解泛型 识别和避免学习使用泛型过程中的陷阱
Brian Goetz (brian@quiotix.com), 首席顾问, Quiotix 简介: JDK 5.0 中增加的泛型类型,是 Java 语言中类型安全的一次重要改进.但是,对于初次使用泛 ...
- java ArithUtil 数据计算精度工具
ArithUtil: /** * 如果需要精确计算,非要用String来够造BigDecimal不可 */ package com.leaniot.securitymonitor.util; impo ...
- MongoDB 增删改查 Shell使用及操作
下载链接:https://robomongo.org/download 安装步骤省略,下一步下一步... 图形界面,连接默认,取个名字就行. 连接成功,可以愉快的使用了,不用总是敲命令了,简洁方便,多 ...