I am looking at the following code
import mockit.Mock;
import mockit.MockUp;
new MockUp<Fubar>() {
@Mock
delete(final String fooId) {
assertEquals(fooId, "foo123");
}
};
I note that this is not being assigned to any variable. I am guessing that somehow (and I read about class loaders someplace) this causes every instance of Fubar to be defined with this mocked method delete, even if it is instantiated elsewhere. (I would guess this happens in such a way that timing does not matter?) Is there something called Mockit which is different than Mockito? I have seen this pattern more than once in the existing code, so I do not believe it is a typo.
EDIT: Please do not downvote this without explanation as to why. This is a legit question that I have already spent significant time attempting to research.
EDIT: Not one post discussed what the code's probable intention is but instead dwelt on my failure to identify what mocking framework was used.