InstantiatorProvider2and Issue 1303
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
This class is deprecated and was replaced by
InstantiatorProvider2. Hence if there is both a
mockito-extensions/org.mockito.plugins.InstantiatorProvider2 the second one
@Deprecated public interface InstantiatorProvider