开发者

jMock What is Context

Reading a jmock docs i see:

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.

I like to know what mean "context in which the Publisher exists", this is a scope of the class or something like?


It's overly formal language, it's only saying that the Mockery holds the record of all of the mock objects under test at any given time. In 99% of cases, each test case has one Mockery, and therefore the test case is the context.

The language used in that part of the docs seems more appropriate if you're thinking from the point of view of how JMock is designed internally, rather than as a writer of unit tests.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜