public interface MockPolicyInterceptionSettings
Since mock policies can be chained subsequent policies can override behavior of a previous policy. To avoid accidental overrides it's recommended add behavior instead of setting behavior since the latter overrides all previous configurations.
Modifier and Type | Method and Description |
---|---|
void |
addFieldToSuppress(Field[] fields)
Add specific fields that should be suppressed upon invocation.
|
void |
addFieldToSuppress(Field firstField,
Field... additionalFields)
Add specific fields that should be suppressed upon invocation.
|
void |
addFieldTypesToSuppress(String[] fieldTypes)
Add field types that should be suppressed.
|
void |
addFieldTypesToSuppress(String firstType,
String... additionalFieldTypes)
Add field types that should be suppressed.
|
void |
addMethodsToSuppress(Method[] methods)
Add methods to suppress upon invocation.
|
void |
addMethodsToSuppress(Method methodToSuppress,
Method... additionalMethodsToSuppress)
Add methods to suppress upon invocation.
|
void |
addSubtituteReturnValue(Method method,
Object returnObject)
Deprecated.
Use
stubMethod(Method, Object) instead. |
Field[] |
getFieldsToSuppress() |
String[] |
getFieldTypesToSuppress() |
Method[] |
getMethodsToSuppress() |
Map<Method,InvocationHandler> |
getProxiedMethods()
Get all methods that should be proxied and the invocation handler for
each method.
|
Map<Method,Object> |
getStubbedMethods()
Get all substitute return values and also returns an unmodifiable map of
all method-object pairs the were initialized.
|
Map<Method,Object> |
getSubstituteReturnValues()
Deprecated.
Use
getStubbedMethods() instead. |
void |
proxyMethod(Method method,
InvocationHandler invocationHandler)
Proxy a method with the given invocation handler.
|
void |
setFieldsSuppress(Field[] fields)
Set specific fields that should be suppressed upon invocation.
|
void |
setFieldTypesToSuppress(String[] fieldTypes)
Set which field types that should be suppressed.
|
void |
setMethodsToProxy(Map<Method,InvocationHandler> proxies)
Set the methods to proxy.
|
void |
setMethodsToStub(Map<Method,Object> substituteReturnValues)
Set the substitute return values.
|
void |
setMethodsToSuppress(Method[] methods)
Set which methods to suppress.
|
void |
setSubtituteReturnValues(Map<Method,Object> substituteReturnValues)
Deprecated.
Use
stubMethod(Method, Object) instead. |
void |
stubMethod(Method method,
Object returnObject)
Add a method that should be intercepted and return another value (
returnObject ) (i.e. |
void setMethodsToSuppress(Method[] methods)
void addMethodsToSuppress(Method methodToSuppress, Method... additionalMethodsToSuppress)
void addMethodsToSuppress(Method[] methods)
void setMethodsToStub(Map<Method,Object> substituteReturnValues)
Note that this overrides all previous configurations.
void stubMethod(Method method, Object returnObject)
returnObject
) (i.e. the method is stubbed).void proxyMethod(Method method, InvocationHandler invocationHandler)
Map<Method,InvocationHandler> getProxiedMethods()
void setMethodsToProxy(Map<Method,InvocationHandler> proxies)
Note that this overrides all previous configurations.
@Deprecated void setSubtituteReturnValues(Map<Method,Object> substituteReturnValues)
stubMethod(Method, Object)
instead.Note that this overrides all previous configurations.
@Deprecated void addSubtituteReturnValue(Method method, Object returnObject)
stubMethod(Method, Object)
instead.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.void setFieldsSuppress(Field[] fields)
void addFieldToSuppress(Field firstField, Field... additionalFields)
void addFieldToSuppress(Field[] fields)
void setFieldTypesToSuppress(String[] fieldTypes)
void addFieldTypesToSuppress(String firstType, String... additionalFieldTypes)
void addFieldTypesToSuppress(String[] fieldTypes)
Method[] getMethodsToSuppress()
Map<Method,Object> getStubbedMethods()
@Deprecated Map<Method,Object> getSubstituteReturnValues()
getStubbedMethods()
instead.Field[] getFieldsToSuppress()
null
or other default values).String[] getFieldTypesToSuppress()
Copyright © 2019. All rights reserved.