1 /* 2 * Copyright (c) 2007 Mockito contributors 3 * This program is made available under the terms of the MIT License. 4 */ 5 6 package org.mockito.mock; 7 8 import org.mockito.Incubating; 9 import org.mockito.listeners.InvocationListener; 10 import org.mockito.stubbing.Answer; 11 12 import java.util.List; 13 import java.util.Set; 14 15 /** 16 * Informs about the mock settings. An immutable view of {@link org.mockito.MockSettings}. 17 */ 18 public interface MockCreationSettings<T> { 19 20 /** 21 * Mocked type. An interface or class the mock should implement / extend. 22 */ getTypeToMock()23 Class<T> getTypeToMock(); 24 25 /** 26 * the extra interfaces the mock object should implement. 27 */ getExtraInterfaces()28 Set<Class<?>> getExtraInterfaces(); 29 30 /** 31 * the name of this mock, as printed on verification errors; see {@link org.mockito.MockSettings#name}. 32 */ getMockName()33 MockName getMockName(); 34 35 /** 36 * the default answer for this mock, see {@link org.mockito.MockSettings#defaultAnswer}. 37 */ getDefaultAnswer()38 Answer<?> getDefaultAnswer(); 39 40 /** 41 * the spied instance - needed for spies. 42 */ getSpiedInstance()43 Object getSpiedInstance(); 44 45 /** 46 * if the mock is serializable, see {@link org.mockito.MockSettings#serializable}. 47 */ isSerializable()48 boolean isSerializable(); 49 50 /** 51 * @return the serializable mode of this mock 52 */ getSerializableMode()53 SerializableMode getSerializableMode(); 54 55 /** 56 * Whether the mock is only for stubbing, i.e. does not remember 57 * parameters on its invocation and therefore cannot 58 * be used for verification 59 */ isStubOnly()60 boolean isStubOnly(); 61 62 /** 63 * The invocation listeners attached to this mock, see {@link org.mockito.MockSettings#invocationListeners}. 64 */ getInvocationListeners()65 List<InvocationListener> getInvocationListeners(); 66 67 /** 68 * Informs whether the mock instance should be created via constructor 69 * 70 * @since 1.10.12 71 */ 72 @Incubating isUsingConstructor()73 boolean isUsingConstructor(); 74 75 /** 76 * Used when mocking non-static inner classes in conjunction with {@link #isUsingConstructor()} 77 * 78 * @return the outer class instance used for creation of the mock object via the constructor. 79 * @since 1.10.12 80 */ 81 @Incubating getOuterClassInstance()82 Object getOuterClassInstance(); 83 } 84