Class MockPolicyInterceptionSettingsImpl
java.lang.Object
org.powermock.mockpolicies.impl.MockPolicyInterceptionSettingsImpl
- All Implemented Interfaces:
MockPolicyInterceptionSettings
public class MockPolicyInterceptionSettingsImpl
extends Object
implements MockPolicyInterceptionSettings
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFieldToSuppress(Field[] fields) Add specific fields that should be suppressed upon invocation.voidaddFieldToSuppress(Field firstField, Field... fields) Add specific fields that should be suppressed upon invocation.voidaddFieldTypesToSuppress(String[] fieldTypes) Add field types that should be suppressed.voidaddFieldTypesToSuppress(String firstType, String... additionalFieldTypes) Add field types that should be suppressed.voidaddMethodsToSuppress(Method[] methods) Add methods to suppress upon invocation.voidaddMethodsToSuppress(Method methodToSuppress, Method... additionalMethodsToSuppress) Add methods to suppress upon invocation.voidaddSubtituteReturnValue(Method method, Object returnObject) Add a method that should be intercepted and return another value (returnObject).Field[]String[]Method[]Get all methods that should be proxied and the invocation handler for each method.Get all substitute return values and also returns an unmodifiable map of all method-object pairs the were initialized.Get all substitute return values and also returns an unmodifiable map of all method-object pairs the were initialized.voidproxyMethod(Method method, InvocationHandler invocationHandler) Proxy a method with the given invocation handler.voidsetFieldsSuppress(Field[] fields) Set specific fields that should be suppressed upon invocation.voidsetFieldTypesToSuppress(String[] fieldTypes) Set which field types that should be suppressed.voidsetMethodsToProxy(Map<Method, InvocationHandler> proxies) Set the methods to proxy.voidsetMethodsToStub(Map<Method, Object> substituteReturnValues) Set the substitute return values.voidsetMethodsToSuppress(Method[] methods) Set which methods to suppress.voidsetSubtituteReturnValues(Map<Method, Object> substituteReturnValues) Set the substitute return values.voidstubMethod(Method method, Object returnObject) Add a method that should be intercepted and return another value (returnObject) (i.e.
-
Field Details
-
fieldsToSuppress
-
methodsToSuppress
-
substituteReturnValues
-
fieldsTypesToSuppress
-
proxies
-
-
Constructor Details
-
MockPolicyInterceptionSettingsImpl
public MockPolicyInterceptionSettingsImpl()
-
-
Method Details
-
addFieldTypesToSuppress
Description copied from interface:MockPolicyInterceptionSettingsAdd field types that should be suppressed.- Specified by:
addFieldTypesToSuppressin interfaceMockPolicyInterceptionSettings
-
addFieldTypesToSuppress
Description copied from interface:MockPolicyInterceptionSettingsAdd field types that should be suppressed.- Specified by:
addFieldTypesToSuppressin interfaceMockPolicyInterceptionSettings
-
setFieldTypesToSuppress
Description copied from interface:MockPolicyInterceptionSettingsSet which field types that should be suppressed. Note that this overrides all previous configurations.- Specified by:
setFieldTypesToSuppressin interfaceMockPolicyInterceptionSettings
-
getFieldsToSuppress
- Specified by:
getFieldsToSuppressin interfaceMockPolicyInterceptionSettings- Returns:
- Which fields should be suppressed (i.e. will be set to
nullor other default values).
-
getMethodsToSuppress
- Specified by:
getMethodsToSuppressin interfaceMockPolicyInterceptionSettings- Returns:
- Which methods that should be suppressed/stubbed (i.e. return a default value when invoked).
-
getStubbedMethods
Description copied from interface:MockPolicyInterceptionSettingsGet all substitute return values and also returns an unmodifiable map of all method-object pairs the were initialized.- Specified by:
getStubbedMethodsin interfaceMockPolicyInterceptionSettings
-
addFieldToSuppress
Description copied from interface:MockPolicyInterceptionSettingsAdd specific fields that should be suppressed upon invocation.- Specified by:
addFieldToSuppressin interfaceMockPolicyInterceptionSettings
-
addFieldToSuppress
Description copied from interface:MockPolicyInterceptionSettingsAdd specific fields that should be suppressed upon invocation.- Specified by:
addFieldToSuppressin interfaceMockPolicyInterceptionSettings
-
addMethodsToSuppress
Description copied from interface:MockPolicyInterceptionSettingsAdd methods to suppress upon invocation.- Specified by:
addMethodsToSuppressin interfaceMockPolicyInterceptionSettings
-
addMethodsToSuppress
Description copied from interface:MockPolicyInterceptionSettingsAdd methods to suppress upon invocation.- Specified by:
addMethodsToSuppressin interfaceMockPolicyInterceptionSettings
-
stubMethod
Description copied from interface:MockPolicyInterceptionSettingsAdd a method that should be intercepted and return another value (returnObject) (i.e. the method is stubbed).- Specified by:
stubMethodin interfaceMockPolicyInterceptionSettings
-
setFieldsSuppress
Description copied from interface:MockPolicyInterceptionSettingsSet specific fields that should be suppressed upon invocation. Note that this overrides all previous configurations.- Specified by:
setFieldsSuppressin interfaceMockPolicyInterceptionSettings
-
setMethodsToSuppress
Description copied from interface:MockPolicyInterceptionSettingsSet which methods to suppress. Note that this overrides all previous configurations.- Specified by:
setMethodsToSuppressin interfaceMockPolicyInterceptionSettings
-
setMethodsToStub
Description copied from interface:MockPolicyInterceptionSettingsSet the substitute return values. The substitute return values is a key-value map where each key is a method that should be intercepted and each value is the new return value for that method when it's intercepted.Note that this overrides all previous configurations.
- Specified by:
setMethodsToStubin interfaceMockPolicyInterceptionSettings
-
getFieldTypesToSuppress
- Specified by:
getFieldTypesToSuppressin interfaceMockPolicyInterceptionSettings- Returns:
- The fully-qualified names to the fields that should be suppressed.
-
addSubtituteReturnValue
Description copied from interface:MockPolicyInterceptionSettingsAdd a method that should be intercepted and return another value (returnObject). The substitute return values is a key-value map where each key is a method that should be intercepted and each value is the new return value for that method when it's intercepted.- Specified by:
addSubtituteReturnValuein interfaceMockPolicyInterceptionSettings
-
setSubtituteReturnValues
Description copied from interface:MockPolicyInterceptionSettingsSet the substitute return values. The substitute return values is a key-value map where each key is a method that should be intercepted and each value is the new return value for that method when it's intercepted.Note that this overrides all previous configurations.
- Specified by:
setSubtituteReturnValuesin interfaceMockPolicyInterceptionSettings
-
getSubstituteReturnValues
Description copied from interface:MockPolicyInterceptionSettingsGet all substitute return values and also returns an unmodifiable map of all method-object pairs the were initialized.- Specified by:
getSubstituteReturnValuesin interfaceMockPolicyInterceptionSettings
-
getProxiedMethods
Description copied from interface:MockPolicyInterceptionSettingsGet all methods that should be proxied and the invocation handler for each method.- Specified by:
getProxiedMethodsin interfaceMockPolicyInterceptionSettings
-
proxyMethod
Description copied from interface:MockPolicyInterceptionSettingsProxy a method with the given invocation handler. Each call to the method will be routed to the invocationHandler instead.- Specified by:
proxyMethodin interfaceMockPolicyInterceptionSettings
-
setMethodsToProxy
Description copied from interface:MockPolicyInterceptionSettingsSet the methods to proxy. The proxies are a key-value map where each key is a method that should be intercepted and routed to the invocation handler instead.Note that this overrides all previous configurations.
- Specified by:
setMethodsToProxyin interfaceMockPolicyInterceptionSettings
-