Package org.powermock.api.support
Class SuppressCode
java.lang.Object
org.powermock.api.support.SuppressCode
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
suppressConstructor
(Class<?>... classes) Suppress all constructors in the given class and it's super classes.static void
suppressConstructor
(Class<?> clazz, boolean excludePrivateConstructors) Suppress all constructors in the given class.static void
suppressConstructor
(Constructor<?>... constructors) Suppress constructor calls on specific constructors only.static void
suppressField
(Class<?>[] classes) Suppress all fields for these classes.static void
suppressField
(Class<?> clazz, String... fieldNames) Suppress multiple methods for a class.static void
suppressField
(Field... fields) Suppress specific fields.static void
suppressMethod
(Class<?>[] classes) Suppress all methods for these classes.static void
suppressMethod
(Class<?> clazz, boolean excludePrivateMethods) suSuppress all methods for this class.static void
suppressMethod
(Class<?> cls, Class<?>... additionalClasses) Suppress all methods for these classes.static void
suppressMethod
(Class<?> clazz, String[] methodNames) Suppress multiple methods for a class.static void
suppressMethod
(Class<?> clazz, String methodName, Class<?>[] parameterTypes) Suppress a specific method call.static void
suppressMethod
(Class<?> clazz, String methodName, String... additionalMethodNames) Suppress multiple methods for a class.static void
suppressMethod
(Method... methods) Suppress specific method calls on all types containing this method.static void
suppressSpecificConstructor
(Class<?> clazz, Class<?>... parameterTypes) This method can be used to suppress the code in a specific constructor.
-
Constructor Details
-
SuppressCode
public SuppressCode()
-
-
Method Details
-
suppressConstructor
Suppress constructor calls on specific constructors only. -
suppressSpecificConstructor
This method can be used to suppress the code in a specific constructor.- Parameters:
clazz
- The class where the constructor is located.parameterTypes
- The parameter types of the constructor to suppress.
-
suppressConstructor
Suppress all constructors in the given class and it's super classes.- Parameters:
classes
- The classes whose constructors will be suppressed.
-
suppressConstructor
Suppress all constructors in the given class.- Parameters:
classes
- The classes whose constructors will be suppressed.excludePrivateConstructors
- optionally keep code in private constructors
-
suppressField
Suppress specific fields. This works on both instance methods and static methods. Note that replay and verify are not needed as this is not part of a mock behavior. -
suppressField
Suppress all fields for these classes. -
suppressField
Suppress multiple methods for a class.- Parameters:
classes
- The class whose methods will be suppressed.fieldNames
- The names of the methods that'll be suppressed. If field names are empty, all fields in the supplied class will be suppressed.
-
suppressMethod
Suppress specific method calls on all types containing this method. This works on both instance methods and static methods. Note that replay and verify are not needed as this is not part of a mock behavior. -
suppressMethod
Suppress all methods for these classes.- Parameters:
cls
- The first class whose methods will be suppressed.additionalClasses
- Additional classes whose methods will be suppressed.
-
suppressMethod
Suppress all methods for these classes.- Parameters:
classes
- Classes whose methods will be suppressed.
-
suppressMethod
public static void suppressMethod(Class<?> clazz, String methodName, String... additionalMethodNames) Suppress multiple methods for a class.- Parameters:
clazz
- The class whose methods will be suppressed.methodName
- The first method to be suppress in classclazz
.additionalMethodNames
- Additional methods to suppress in classclazz
.
-
suppressMethod
Suppress multiple methods for a class.- Parameters:
clazz
- The class whose methods will be suppressed.methodNames
- Methods to suppress in classclazz
.
-
suppressMethod
suSuppress all methods for this class.- Parameters:
classes
- The class which methods will be suppressed.excludePrivateMethods
- optionally not suppress private methods
-
suppressMethod
Suppress a specific method call. Use this for overloaded methods.
-