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 ...
随机推荐
- LINUX企业应用案例精解 第2版 李晨光
LINUX企业应用案例精解 第2版 李晨光 下载地址:https://pan.baidu.com/s/1AAKpc-l-qGTSX5h03M01XA 关注微信公众号获取提取码: 输入:lin7 获取提 ...
- Centos7.3部署安装Maven
需要提前配置好java环境 1.下载压缩包 将安装包下载到root家目录下 http://maven.apache.org/download.cgi 选择bin.tar.gz格式的压缩包 我是直接执行 ...
- [LeetCode] 857. Minimum Cost to Hire K Workers 雇K个工人的最小花费
There are N workers. The i-th worker has a quality[i] and a minimum wage expectation wage[i]. Now w ...
- QT 安装 配置过程
QT, QT creator的安装,环境配置: 需要根据这个连接重新梳理一遍:https://blog.csdn.net/win_turn/article/details/50465127 1)一种方 ...
- 倒数第K个结点
typedef struct Lnode{ int data; struct Lnode *next; }Lnode,*Link; Link fi(Link head,int k){ Link fa ...
- npm包的语义版本控制(Semantic Versioning of Packages)
本文删改自Node.js 8 the Right Way Part I Chapter 3 npm 使用语义版本控制(SemVer)来寻找包的最佳可用兼容版本. 以安装测试框架mocha为例 $ ...
- 【LeetCode】整数反转【不能借助辅助空间,需要处理溢出】
给出一个 32 位的有符号整数,你需要将这个整数中每位上的数字进行反转. 示例 1: 输入: 123 输出: 321 示例 2: 输入: -123 输出: -321 示例 3: 输入: 120 输出: ...
- 【转帖】两种IO模式:Proactor与Reactor模式
两种IO模式:Proactor与Reactor模式 https://www.cnblogs.com/pigerhan/p/3474217.html. 挺好的说明了epoll和IOCP的区别 在高性能的 ...
- 手把手带你写一个minishell
先解释一下Shell : Shell是一个功能为命令行解释器的应用程序,连接了用户和Linux内核,让我们能高效和安全地使用Linux内核. 要写一个minishell,我们要先理解它的过程: 读取输 ...
- linux查看进程与结束进程
查看所有进程 ps -ef ps -ef | grep 查找的进程名 结束进程 ps -ef | grep 查找的进程名 | grep -v grep | awk '{print $2}' | xar ...