将模仿对象作为参数来调用域代码。
模仿对象用来单独测试代码逻辑的一部分。
Mock objects are used to test a portion of your code logic in isolation from the rest of the code.
这需要考虑到使用动态模仿对象的可靠测试策略。
This allows for a reliable testing strategy that USES dynamic mock objects.
您可以将模仿对象测试与各种技巧和技术组合起来。
You can combine mock object testing with a variety of techniques and technologies.
但模仿对象不仅仅只是还未存在的组件的存根。
模仿对象:遵循模仿对象模式的合作者的子类(或实现)。
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.
在这个解决方案中,执行查找的代码被返回模仿对象的代码自动替换。
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.
注:根据模仿对象的创造者所说,它应该在其validate()方法内部执行自己的所有验证。
Note: According to its inventors, a mock object is supposed to perform all of its own validation inside its validate() method.
在我考虑DAO的方式中,模仿对象是很基本的,以致我无法想象在缺少其中一个的情况下如何实现另一个。
Mock objects are so fundamental to the way that I think about DAOs that I couldn't imagine implementing one without the other.
商务印书馆是近代中国最富盛名的出版企业,它的古籍出版同样能够成为其他出版企业的竞相模仿对象。
Commercial Press is the most famous modern Chinese publishing enterprises, its ancient books to be published in other publishing enterprises of the competing models.
模仿谈话对象的动作是一种常见的人类行为,被归类为“镜像”,而心理学家对其的认知和研究已有多年。
Emulating your conversation partner's actions is a common human behavior classified as "mirroring" and has been known and studied by psychologists for years.
美国应该成为一个可看可摸的观察对象(而不是不加思考的模仿),而中国则应成为时时关心与回忆的话题。
America should become an object of explicit observation (not thoughtless imitation) while China remains a topic of concern and memory.
对于科学家IrenePepperberg博士来说,Alex,这只30岁的实验对象削弱了“鹦鹉只是简单的模仿生物”这一观念。
A 30-year research subject for scientist Irene Pepperberg, PhD, Alex whittled away at the belief that parrots were simple mimics.
KentBeck将模拟对象描述为测试对象,该对象可以使用常量进行响应,从而实现开销大或复杂的资源的模仿版本。
Kent Beck describes a mock object as a testing object, one that implements a fake version of an expensive or complicated resource by answering constants.
模拟对象将模仿出于指导代码执行的惟一目的而编写的类的行为,以便它在测试时符合代码执行要求。
Mock objects mimic the behavior of classes written with the sole purpose of guiding code execution so that it falls within those areas under test.
“但是仅仅模仿同伴并非就是成功的秘诀,”肯德尔说,“能够在时间上及学习对象上具有选择性的动物往往更胜一筹。”
"But it is not always a recipe for success to simply copy someone," said Kendal. "Animals are often better off being selective about when and who they copy."
我担忧,因为这一类设计虽然适用于某些场合,但在更多的场合中并不恰当,而它已经成为唯一一种能获奖的网页设计。 正因如此,它也成为年轻设计师争相模仿的对象。
I worry because this type of design, which is appropriate in certain settings and inappropriate in many others, is the only type of web design achieving recognition.
我担忧,因为这一类设计虽然适用于某些场合,但在更多的场合中并不恰当,而它已经成为唯一一种能获奖的网页设计。 正因如此,它也成为年轻设计师争相模仿的对象。
I worry because this type of design, which is appropriate in certain settings and inappropriate in many others, is the only type of web design achieving recognition.
应用推荐