• Dummy objects are passed around but never actually used. Usually they are just used to fill parameter lists.
    假对象会被传递但永远不会被实际使用。通常它们只是用来填充参数列表。
  • Fake objects actually have working implementations, but usually take some shortcut which makes them not suitable for production (an in memory database is a good example).
    伪对象实际上具有可工作的实现,但通常会采用某些捷径,使其不适合用于生产环境(内存数据库就是一个很好的例子)。
  • Stubs provide canned answers to calls made during the test, usually not responding at all to anything outside what’s programmed in for the test.
    Stubs(存根)为测试期间的调用提供预设答案,通常完全不会响应超出测试设定范围的内容。
  • Spies are stubs that also record some information based on how they were called. One form of this might be an email service that records how many messages it was sent.
    Spies(监视)是记录基于调用方式的某些信息的 stubs。一个典型例子是邮件服务,它会记录自己被发送了多少条消息。
  • Mocks are what we are talking about here: objects pre-programmed with expectations which form a specification of the calls they are expected to receive.
    此处我们讨论的是 Mocks(模拟对象):它们带有预先编程的期望值,并以此形成对其应接收调用的规范描述。

Behaviour Verify

There are basically four types of verification: unorderedorderedsequential and all.