You certainly shouldn't ditch teamwork, but how can you avoid the hazards of being an over-collaborator?
你当然不应该放弃团队合作。但如何才能避免过度合作带来的风险呢?
Have a collaborator stand at the exit.
让一位合作者站在出口处。
Problem: The object being tested creates a collaborator object.
问题:正在测试的对象创建了合作者对象。
Identify all occurrences of code that create or obtain the collaborator.
标识创建或获取合作者的代码的所有出现。
In your test code, create a mock object implementing the same interface as the collaborator.
在测试代码中,创建模仿对象且实现与合作者相同的接口。
If you learn what it takes to be a good collaborator, you'll also be a good conversationalist.
如果你了解如何才能成为一个好的合作者,你将是一个好的沟通者。
For instance, you may change the method signature so that the collaborator object is passed in.
例如,可以更改方法签名,以便传入合作者对象。
Instead, that object is designed to either create, look up, or otherwise obtain its collaborator.
而设计该对象是为了创建、查找或获得其合作者。
Mock object: a subclass (or implementation) of the collaborator that follows the mock object pattern.
模仿对象:遵循模仿对象模式的合作者的子类(或实现)。
A GDS could consider Vayant competition or collaborator, and we've seen both reactions in the market.
GDS可以将Vayant看作是竞争对手,也可以看作是合作伙伴,这两种反应我们在市场上都看到过。
By using JNDI enc, the dependent object can explicitly request a reference to a certain collaborator.
通过使用JNDIENC,依赖对象可以显式地请求对某个协作者的引用。
Mr Prahalad invariably worked with a collaborator and never wrote more than two articles on the same subject.
普拉哈拉德始终与人合作,从不就一个问题写两篇以上的文章。
Having moved to the University of Cambridge he needed a collaborator to help him apply these techniques in human patients.
在移居到英国剑桥大学后,他需要一个合作者来帮他把这些技术应用到人类患者身上。
Specialization object: a subclass of the target that overrides the creation method to return a mock instead of a collaborator.
特殊化对象:覆盖创建方法以返回模仿对象而不是合作者的目标的子类。
In this case, the aspect determines when some behavior should be executed but delegates to a collaborator to perform the actual work.
在这种情况下,方面确定什么时候应当执行某些行为,但是会委托给协作器去执行实际的工作。
Kandinsky was the friend and collaborator of the grandfather of abstract music, composer Arnold Schoenberg (1874-1951), who also painted.
康氏与抽象音乐的教父、作曲家勋伯格(生于一八七四,卒于一九五一)是朋友,也是工作伙伴。
If production code has no need to instantiate many types of this collaborator, then adding that ability will make the resulting design needlessly hard to understand.
如果产品代码无需实例化该合作者的多个类型,那么添加该功能将使最终的设计不必要地变得难于理解。
[font=Times New Roman][color=#000000]Once Davis's scientists had pronounced the general idea sound, they and Dr Matthews looked around for a commercial collaborator.
[color=#000000][font=宋体]戴维斯(注:即加利福尼亚大学癌症中心)的科学家们在认定这一总体构想具有可行性之后,即与马修斯一起开始寻找商业合作者。
About 25 years ago, Wegner and his collaborator andfuture wife, Toni, had an insight into how memory works, sparked by a questionabout where they had stored a sponge used for washing the car.
大约25年前,韦格纳和他的搭档托尼(他未来的妻子),曾研究过记忆是如何工作的,是从他们把用来洗车的海绵放在了哪里的问题上引发的思考。
Collaborator is the class you must mock appropriately.
Collaborator是必须正确模拟的类。
The Collaborator class constructor is still quite simple.
Collaborator类构造函数仍然十分简单。
Listing 6 shows the changes made to the Collaborator object.
清单6显示了对Collaborator对象所做的更改。
Collaborator object: the object created or obtained by the target.
合作者对象:由目标对象创建或获取的对象。
Listing 13 shows the most important part of the test example: the Collaborator class.
清单13显示了测试示例的最重要部分:collaborator类。
The only way of instantiating the Collaborator object is to provide two simple arguments.
实例化Collaborator对象的惟一方法是提供两个简单参数。
The second thing to notice is that, conversely, you couldn't use the jMock framework to mock the Collaborator class.
反过来,需要注意的第二点是您不能使用jMock框架来模拟 Collaborator 类。
Also suppose that the Collaborator object requires a string and a primitive int as parameters passed to the constructor.
同时假定Collaborator对象要求使用字符串和原始的int作为传递给构造函数的参数。
Also suppose that the Collaborator object requires a string and a primitive int as parameters passed to the constructor.
同时假定Collaborator对象要求使用字符串和原始的int作为传递给构造函数的参数。
应用推荐