当前位置:网站首页>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"
边栏推荐
- 云原生落地进入深水区,博云容器云产品族释放四大价值
- Interpreting the spirit of unity and cooperation in maker Education
- 896. monotonic sequence
- Tp6+redis+think-queue+supervisor implements the process resident message queue /job task
- 899. ordered queue
- 1161 Merging Linked Lists
- In depth learning series 47:stylegan summary
- 407-栈与队列(232.用栈实现队列、225. 用队列实现栈)
- Eureka
- 关于#sql#的问题:有没有不增加字段,在原有字段的基础上,对字段里面的null值进行填充的方法呢
猜你喜欢

MySQL(四) — MySQL存储引擎

Analyzing the creation principle in maker Education

GloRe

deeplab v3 代码结构图

Deeplab V3 code structure diagram

对二进制的某一位操作

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

深度学习系列47:styleGAN总结

How to migrate virtual machines from VirtualBox to hype-v

excel高级绘图技巧100讲(八)-Excel绘制WIFI图
随机推荐
Database principle experiment test questions, about book classification table
306. Addenda
GloRe
301. 删除无效的括号
直播回顾 | 传统应用进行容器化改造,如何既快又稳?
Eureka
Nacos适配oracle11g-建表ddl语句
技术文章写作指南
SSM整合
【***数组***】
如何达到高效的网络信息传播
Flannel 工作原理
307. 区域和检索 - 数组可修改
MySQL总结
Interpreting the spirit of unity and cooperation in maker Education
深度学习系列47:styleGAN总结
897. incremental sequential search tree
数据统计与分析基础 实验一 基本语法及运算
启发式的搜索策略
初始化层实现