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

org.mockito.internal.creation.bytebuddy.SubclassLoader Maven / Gradle / Ivy

There is a newer version: 5.12.0
Show newest version
/*
 * Copyright (c) 2017 Mockito contributors
 * This program is made available under the terms of the MIT License.
 */
package org.mockito.internal.creation.bytebuddy;

import net.bytebuddy.dynamic.loading.ClassLoadingStrategy;

/**
 * A subclass loader is responsible for resolving a class loading strategy for a mock that is implemented as a subclass.
 */
public interface SubclassLoader {

    /**
     * Checks if this loader does not require a module to be open.
     *
     * @return {@code true} if this loader is not constraint to a target module being opened for loading a class.
     */
    boolean isDisrespectingOpenness();

    /**
     * Resolves a class loading strategy.
     *
     * @param mockedType  The type being mocked.
     * @param classLoader The class loader being used.
     * @param localMock   {@code true} if the mock is loaded within the runtime package of the mocked type.
     * @return An appropriate class loading strategy.
     */
    ClassLoadingStrategy resolveStrategy(
            Class mockedType, ClassLoader classLoader, boolean localMock);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy