The hidden costs of mock injection
pablisco
1262

We do the same thing — actually have a two classes, Mocks and Stubs in our test suite that are just a bunch of static factory methods describing the test double being created.

I’ve avoided using MockitoRunner or any mutable fields in general because it may introduce issues if you need to run your test in parallel.

That being said, I believe that every call to Mockito.mock(T) is using reflection anyways so it will always be slower than “natively” created test doubles.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.