当前位置:网站首页>EasyMock日记1[通俗易懂]
EasyMock日记1[通俗易懂]
2022-07-31 12:50:00 【全栈程序员站长】
大家好,又见面了,我是你们的朋友全栈君。
private PayController payController;
private HttpServletRequest request;
private User user;
private HttpSession session;
@Before
public void before(){
payController=new PayController();
user=new User();
user.setUsername("18350591915");
user.setUseNo("4f62f0e5516346748843df6131072ae0");
}
@Test
public void Testalipay_notify(){
request=EasyMock.createMock(HttpServletRequest.class);
session=EasyMock.createMock(HttpSession.class);
EasyMock.expect(request.getParameter("type")).andReturn("1");
EasyMock.expect(request.getParameter("money")).andReturn("1");
EasyMock.expect(request.getParameter("paymentId")).andReturn("1");
//EasyMock.expect((User)request.getSession().getAttribute("user")).andReturn(user);
//这句话不知道为什么不能实现``
EasyMock.expect(request.getSession()).andReturn(session);
EasyMock.expect(session.getAttribute("user")).andReturn(user);
EasyMock.replay(request);
assertNotNull(payController.recharge(null, request));
EasyMock.verify(request);
}
参考http://blog.csdn.net/chjttony/article/details/14522771[参考地址](http://blog.csdn.net/chjttony/article/details/14522771%20%E5%8F%82%E8%80%83%E5%8D%9A%E5%AE%A2easymock)发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/128637.html原文链接:https://javaforall.cn
边栏推荐
- ASM module in SAP Ecommerce Cloud Spartacus UI and Accelerator UI
- 纷享销客罗旭对话元气森林黄晓枫:零售数字化的终点不是创新,而是数据
- 基本语法(二)
- Use docker to build mysql master-slave
- vivado里那些看不懂的原语
- Hard disk partition, expand disk C, no reshipment system, not heavy D dish of software full tutorial.
- 关于我放弃考研这件事儿
- PAT考试总结(考试心得)
- 最长算术(暑假每日一题 11)
- Double non-one into bytes!!Pure dry goods sharing
猜你喜欢

Selenium自动化测试之Selenium IDE
![LRU缓存[线性表 -> 链表 -> hash定位 -> 双向链表]](/img/ad/dd80541514d6fedde8c730218fdf5a.png)
LRU缓存[线性表 -> 链表 -> hash定位 -> 双向链表]

NPM 使用介绍

串的基本概念与操作

系统集成项目管理工程师(软考中级)知识点总结【挣值分析】【关键路径】

架构实战营|模块8

The 2nd activity of the TOGAF10 Standard Reading Club continues wonderfully, and the highlights will be reviewed!

Optimization of five data submission methods

golang八股文整理(持续搬运)

CentOS7 安装MySQL 图文详细教程
随机推荐
Quickly learn database management
硬盘分区,拓展C盘,不重装系统,不重装D盘软件的全教程。
Centos7 install mysql5.7
alert(1) (haozi.me)靶场练习
[Shader] Shader official example [easy to understand]
Anaconda安装labelImg图像标注软件
Hybrid brain-computer interface system based on steady-state visual evoked potentials and attentional EEG
小试牛刀—猜数字游戏
Indoor real-time laser SLAM control method based on biological excitation neural network
初识QEMU
基本语法(二)
想吃菌子,当然是自己上山找了
ERROR 2003 (HY000) Can‘t connect to MySQL server on ‘localhost3306‘ (10061)解决办法
Qt鼠标穿透
五种数据提交方式的优化
Three-Phase PWM Rectifier Predictive Direct Power Control
使用openssl命令生成证书和对应的私钥,私钥签名,公钥验签
Using SQL Server FOR XML and FOR JSON syntax on other RDBMSs with jOOQ
函数递归1.0
基于姿态估计的护具佩戴检测与动作识别