I am currently writing a couple of tests involving JMock. I can not understand the following code structure:
context.checking(new Expectations() { //context is of type Mockery of course { allowing(csv).getFileName(); will(returnValue(fileName)); } });
Analyzing slowly, as far as I know,
context.checking(new Expectations() { ... }
This will create an anonymous instance of Expectations . But why do we have other brackets right after that, and then some weird, static methods, I think, such as allow (), etc.? If someone could explain to me from the point of view of Java what is happening here, I would be very grateful.
Bober02
source share