gpt4 book ai didi

java - jMock 什么是上下文

转载 作者:行者123 更新时间:2023-12-01 15:52:21 24 4
gpt4 key购买 nike

阅读我看到的 jmock 文档:

First we must import the jMock classes, define our test fixture class and create a "Mockery" that represents the context in which the Publisher exists. The context mocks out the objects that the Publisher collaborates with (in this case a Subscriber) and checks that they are used correctly during the test.

我想知道“发布者存在的上下文”是什么意思,这是类的范围还是类似的东西?

最佳答案

这是一种过于正式的语言,它只是说 Mockery 保存了在任何给定时间测试的所有模拟对象的记录。在 99% 的情况下,每个测试用例都有一个 Mockery,因此测试用例就是上下文。

如果您从 JMock 内部设计的角度思考,而不是从单元测试编写者的角度思考,那么这部分文档中使用的语言似乎更合适。

关于java - jMock 什么是上下文,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5766560/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com