当前位置:网站首页>Spock sub piling
Spock sub piling
2022-06-23 07:15:00 【qq_ thirty-seven million two hundred and seventy-nine thousand 】
Stubbing It is the behavior that enables the collaborator to respond to method calls in some way . When you stub a method , Don't care about the number of calls to this method , Just hope it returns some values when called , Or perform some reaction .
subscriber.receive(_) >> "ok"
| | | |
| | | response generator
| | argument constraint
| method constraint
target constraint
Such as :subscriber.receive(_) >> "ok" meaning , No matter what instance , What parameters , call receive Methods return strings ok
Return fixed value
Use >> Operator , Return fixed value
subscriber.receive(_) >> "ok"
Return value sequence
Return a sequence , Iterates and returns the specified value in turn . As shown below , The first call returns ok, The second call returns error, And so on
subscriber.receive(_) >>> ["ok", "error", "error", "ok"]
Calculate the return value dynamically
subscriber.receive(_) >> { args -> args[0].size() > 3 ? "ok" : "fail" }
subscriber.receive(_) >> { String message -> message.size() > 3 ? "ok" : "fail" }
Produce reaction
subscriber.receive(_) >> { throw new InternalError("ouch") }
Chain response
subscriber.receive(_) >>> ["ok", "fail", "ok"] >> { throw new InternalError() } >> "ok"
边栏推荐
- 100 GIS practical application cases (79) - key points of making multi plan integrated base map
- 别找了诸位 【十二款超级好用的谷歌插件都在这】(确定不来看看?)
- 309. the best time to buy and sell stocks includes the freezing period
- 【AI实战】机器学习数据处理之数据归一化、标准化
- 295. 数据流的中位数
- Deeplab V3 code structure diagram
- C language learning summary
- 898. 子数组按位或操作
- g++编译命令使用
- .h5文件忘记数据库名字,使用h5py打印
猜你喜欢

闫氏DP分析法

MySQL(四) — MySQL存储引擎

100 GIS practical application cases (79) - key points of making multi plan integrated base map

Regular expression graph and text ultra detailed summary without rote memorization (Part 1)

407 stack and queue (232. implementing queue with stack, 225. implementing stack with queue)

406-双指针(27. 移除元素、977.有序数组的平方、15. 三数之和、18. 四数之和)

GINet

RFID数据安全性实验:C#可视化实现奇偶校验、CRC冗余校验、海明码校验

深度学习系列47:超分模型Real-ESRGAN

【博弈论】基础知识
随机推荐
异构交易场景交互流程及一致性保证
U-Net: Convolutional Networks for Biomedical Image Segmentation
Project_ Filter to solve Chinese garbled code
codeforce 158B Taxi
GloRe
315. 计算右侧小于当前元素的个数
[system] right click the desktop icon. After turning around, the Explorer will crash and the desktop will be refreshed
307. 区域和检索 - 数组可修改
Tp6 installation expansion
产品-Axure9(英文版),原型设计 制作下拉二级菜单
Specific help of OSI layered model to work
GINet
313. 超级丑数
Mysql事务隔离级别
pspnet完整代码实现
901. stock price span
Mysql数据库的几个特点
Spock约束-调用频率/目标/方法参数
产品-Axure9(英文版),原型设计后台动态二级菜单显示内容
PSP code implementation