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

com.fitbur.mockito.mock.MockCreationSettings Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version
/*
 * Copyright (c) 2007 Mockito contributors
 * This program is made available under the terms of the MIT License.
 */

package com.fitbur.mockito.mock;

import com.fitbur.mockito.Incubating;
import com.fitbur.mockito.listeners.InvocationListener;
import com.fitbur.mockito.stubbing.Answer;

import java.util.List;
import java.util.Set;

/**
 * Informs about the mock settings. An immutable view of {@link com.fitbur.mockito.MockSettings}.
 */
public interface MockCreationSettings {

    /**
     * Mocked type. An interface or class the mock should implement / extend.
     */
    Class getTypeToMock();

    /**
     * the extra interfaces the mock object should implement.
     */
    Set> getExtraInterfaces();

    /**
     * the name of this mock, as printed on verification errors; see {@link com.fitbur.mockito.MockSettings#name}.
     */
    MockName getMockName();

    /**
     * the default answer for this mock, see {@link com.fitbur.mockito.MockSettings#defaultAnswer}.
     */
    Answer getDefaultAnswer();

    /**
     * the spied instance - needed for spies.
     */
    Object getSpiedInstance();

    /**
     * if the mock is serializable, see {@link com.fitbur.mockito.MockSettings#serializable}.
     */
    boolean isSerializable();

    /**
     * @return the serializable mode of this mock
     */
    SerializableMode getSerializableMode();

    /**
     * Whether the mock is only for stubbing, i.e. does not remember
     * parameters on its invocation and therefore cannot
     * be used for verification
     */
    boolean isStubOnly();

    /**
     * The invocation listeners attached to this mock, see {@link com.fitbur.mockito.MockSettings#invocationListeners}.
     */
    List getInvocationListeners();

    /**
     * Informs whether the mock instance should be created via constructor
     *
     * @since 1.10.12
     */
    @Incubating
    boolean isUsingConstructor();

    /**
     * Used when mocking non-static inner classes in conjunction with {@link #isUsingConstructor()}
     *
     * @return the outer class instance used for creation of the mock object via the constructor.
     * @since 1.10.12
     */
    @Incubating
    Object getOuterClassInstance();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy