/* * Copyright (c) 2007 Mockito contributors * This program is made available under the terms of the MIT License. */ package org.mockito.plugins; import org.mockito.internal.creation.instance.Instantiator; import org.mockito.mock.MockCreationSettings; /** * @deprecated since 2.15.4 because this internal class was leaking from the public API. * For more information why deprecated, see {@link org.mockito.plugins.InstantiatorProvider2} and * 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. *

* *

Using the extension point

* *

* The plugin mechanism of mockito works in a similar way as the * {@link java.util.ServiceLoader}, however instead of looking in the META-INF * directory, Mockito will look in mockito-extensions directory. * The reason for that is that Android SDK strips jar from the META-INF * directory when creating an APK. *

* *
    *
  1. The implementation itself, for example * org.awesome.mockito.AwesomeInstantiatorProvider that implements the * InstantiatorProvider.
  2. *
  3. A file "mockito-extensions/org.mockito.plugins.InstantiatorProvider". * The content of this file is exactly a one line with the qualified * name: org.awesome.mockito.AwesomeInstantiatorProvider.
  4. *

* *

* Note that if several mockito-extensions/org.mockito.plugins.InstantiatorProvider * files exists in the classpath, Mockito will only use the first returned by the standard * {@link ClassLoader#getResource} mechanism. *

* So just create a custom implementation of {@link InstantiatorProvider} and place the * qualified name in the following file * mockito-extensions/org.mockito.plugins.InstantiatorProvider. *

*

* This class is deprecated and was replaced by * {@link org.mockito.plugins.InstantiatorProvider2}. Hence if there is both a * mockito-extensions/org.mockito.plugins.InstantiatorProvider and * mockito-extensions/org.mockito.plugins.InstantiatorProvider2 the second one * takes preference. *

* * @since 2.0.31 */ @Deprecated public interface InstantiatorProvider { /** * @deprecated, see {@link InstantiatorProvider}. * * Returns an instantiator, used to create new class instances. */ @Deprecated Instantiator getInstantiator(MockCreationSettings settings); }