必须用模仿对象替换这个合作者。
设置模仿对象中的状态和期望值
将模仿对象作为参数来调用域代码。
模仿对象提供了解决这一困难的方法。
验证模仿对象中的一致性。
使用模仿对象进行测试的常用编码样式是。
The common coding style for testing with mock objects is to.
模仿对象用来单独测试代码逻辑的一部分。
Mock objects are used to test a portion of your code logic in isolation from the rest of the code.
尤其是,我的设计利用了模仿对象来简化测试。
In particular, my design employed mock objects to make testing easier.
你自信模仿对象不一定是现实中的人。
这需要考虑到使用动态模仿对象的可靠测试策略。
This allows for a reliable testing strategy that USES dynamic mock objects.
我们还使用了实例变量来存储对模仿对象的引用。
We also used an instance variable to store a reference to the mock object.
您可以将模仿对象测试与各种技巧和技术组合起来。
You can combine mock object testing with a variety of techniques and technologies.
但模仿对象不仅仅只是还未存在的组件的存根。
在测试代码中,创建模仿对象且实现与合作者相同的接口。
In your test code, create a mock object implementing the same interface as the collaborator.
模仿对象:遵循模仿对象模式的合作者的子类(或实现)。
Mock object: a subclass (or implementation) of the collaborator that follows the mock object pattern.
在特殊化对象中,覆盖创建方法以返回为测试提供的模仿对象。
In the specialization object, override the creation method to return a mock object that accommodates your test.
测试代码希望它产生另一种类型的对象(模仿对象)。
The test code would like it to produce a different type (a mock).
正如您在测试一节看到的,模仿对象方法完全满足该目标。
As you'll see in the Testing section, a mock-objects approach perfectly matches the goal.
在这个解决方案中,执行查找的代码被返回模仿对象的代码自动替换。
In this solution, the code that performs the lookup is replaced automatically with code that returns a mock object instead.
该层对数据库非常敏感,所以该层不能应用模仿对象或POJT技术。
The layer is well aware of the database, so neither mock objects nor POJT techniques should be applied.
Wicket通过使用内置的模仿对象框架提供对容器外单元测试的支持。
Wicket supports out-of-container unit testing through the use of a built-in mock object framework.
可选的:创建单元测试以确保原始目标对象的工厂方法仍返回正确的非模仿对象。
Optional: create a unit test to assure that the original target object's factory method still returns the correct, non-mock object.
特殊化对象:覆盖创建方法以返回模仿对象而不是合作者的目标的子类。
Specialization object: a subclass of the target that overrides the creation method to return a mock instead of a collaborator.
虽然这种模式对于许多情况都非常有效,但模仿对象有时不能被传递到正在测试的对象。
While this pattern is very effective for many cases, sometimes the mock object cannot be passed into the object being tested.
模仿对象符合实际对象的接口,但只要有足够的代码来“欺骗”测试对象并跟踪其行为。
A mock object conforms to the interface of the real object, but has just enough code to fool the tested object and track its behavior.
最近模仿对象得到了大力推广,但我认为它们被滥用了,它们太“重”以至于不切实际。
Mock objects have gotten a lot of publicity lately, but I think they're overused and often too heavy to be practical.
随着您更加熟练地使用模仿对象,对于将多少验证职责代理给模仿对象,您将会深有体会。
As you grow more comfortable using mock objects, you will develop a feel for how much validation responsibility to delegate to the mock.
可以评估代码如何与模仿对象交互(譬如,验证调用了某个方法多少次以及检查状态等)。
You can evaluate how your code is interacting with mocks (such as verifying how many times a method was called, check state, and so on).
给模仿对象一个接口,您希望实际组件具备这个接口,然后使用模仿对象,直到实际组件成形。
You give the mock objects an interface you want the real components to have, then you use the mocks until the real components take shape.
合并后的公司将成为全美最大的国内航空公司,可能也会成为美国其他六大航空的模仿对象。
They will create America's biggest domestic carrier and could prove to be the spark that lights the flame for others of America's six big airlines.
应用推荐