All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fitbur.mockito.internal.configuration.plugins.PluginRegistry Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version
package com.fitbur.mockito.internal.configuration.plugins;

import com.fitbur.mockito.plugins.InstantiatorProvider;
import com.fitbur.mockito.plugins.MockMaker;
import com.fitbur.mockito.plugins.PluginSwitch;
import com.fitbur.mockito.plugins.StackTraceCleanerProvider;

class PluginRegistry {

    private final PluginSwitch pluginSwitch
            = new PluginLoader(new DefaultPluginSwitch()).loadPlugin(PluginSwitch.class, DefaultPluginSwitch.class.getName());

    private final MockMaker mockMaker
            = new PluginLoader(pluginSwitch).loadPlugin(MockMaker.class, "com.fitbur.mockito.internal.creation.bytebuddy.ByteBuddyMockMaker");

    private final StackTraceCleanerProvider stackTraceCleanerProvider
            = new PluginLoader(pluginSwitch).loadPlugin(StackTraceCleanerProvider.class, "com.fitbur.mockito.internal.exceptions.stacktrace.DefaultStackTraceCleanerProvider");

    private final InstantiatorProvider instantiatorProvider
            = new PluginLoader(pluginSwitch).loadPlugin(InstantiatorProvider.class, "com.fitbur.mockito.internal.creation.instance.DefaultInstantiatorProvider");

    /**
     * The implementation of the stack trace cleaner
     */
    StackTraceCleanerProvider getStackTraceCleanerProvider() {
        //TODO we should throw some sensible exception if this is null.
        return stackTraceCleanerProvider;
    }

    /**
     * Returns the implementation of the mock maker available for the current runtime.
     *
     * 

Returns {@link com.fitbur.mockito.internal.creation.cglib.CglibMockMaker} if no * {@link com.fitbur.mockito.plugins.MockMaker} extension exists or is visible in the current classpath.

*/ MockMaker getMockMaker() { return mockMaker; } /** * Returns the instantiator provider available for the current runtime. * *

Returns {@link com.fitbur.mockito.internal.creation.instance.DefaultInstantiatorProvider} if no * {@link com.fitbur.mockito.plugins.InstantiatorProvider} extension exists or is visible in the current classpath.

*/ InstantiatorProvider getInstantiatorProvider() { return instantiatorProvider; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy