public interface InstantiatorProvider
Mockito will invoke this interface in order to fetch an instance instantiator provider.
By default, an internal byte-buddy/asm/objenesis based implementation is used.
The plugin mechanism of mockito works in a similar way as the
ServiceLoader, however instead of looking in the
directory, Mockito will look in
The reason for that is that Android SDK strips jar from the
directory when creating an APK.
org.awesome.mockito.AwesomeInstantiatorProviderthat implements the
mockito-extensions/org.mockito.plugins.InstantiatorProvider". The content of this file is exactly a one line with the qualified name:
Note that if several
files exists in the classpath, Mockito will only use the first returned by the standard
So just create a custom implementation of
InstantiatorProvider and place the
qualified name in the following file
org.mockito.internal.creation.instance.Instantiator getInstantiator(MockCreationSettings<?> settings)